2
#include "../../Misc/Debug.h"
3
#include "../../Ares.h"
5
// bugfix #471: InfantryTypes and BuildingTypes don't reload their ammo properly
7
DEFINE_HOOK(43FE8E, BuildingClass_Update_Reload, 6)
9
GET(BuildingClass *, B, ESI);
10
BuildingTypeClass *BType = B->Type;
11
if(!BType->Hospital && !BType->Armory) { // TODO: rethink this
17
DEFINE_HOOK(6FCFA4, TechnoClass_GetROF_BuildingHack, 5)
19
GET(TechnoClass *, T, ESI);
20
// actual game code: if(auto B = specific_cast<BuildingClass *>(T)) { if(T->currentAmmo > 1) { return 1; } }
21
// if the object being queried doesn't have a weapon (Armory/Hospital), it'll return 1 anyway
26
DEFINE_HOOK(5200D7, InfantryClass_UpdatePanic_DontReload, 6)
31
DEFINE_HOOK(51BCB2, InfantryClass_Update_Reload, 6)
33
GET(InfantryClass *, I, ESI);
41
DEFINE_HOOK(51DF8C, InfantryClass_Fire_RearmTimer, 6)
43
GET(InfantryClass *, I, ESI);
44
int Ammo = I->Type->Ammo;
45
if(Ammo > 0 && I->Ammo < Ammo) {
51
DEFINE_HOOK(6FF66C, TechnoClass_Fire_RearmTimer, 6)
53
GET(TechnoClass *, T, ESI);
54
if(BuildingClass * B = specific_cast<BuildingClass *>(T)) {
55
int Ammo = B->Type->Ammo;
56
if(Ammo > 0 && B->Ammo < Ammo) {