-
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathHooks.cpp
More file actions
625 lines (479 loc) · 16.1 KB
/
Copy pathHooks.cpp
File metadata and controls
625 lines (479 loc) · 16.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
#include "Body.h"
#include <Ext/Aircraft/Body.h>
#include <Ext/Scenario/Body.h>
#include "Ext/Techno/Body.h"
#include "Ext/Building/Body.h"
#include <Ext/Event/Body.h>
#include <unordered_map>
// Trigger power recalculation on gain/loss of any techno, not just buildings.
DEFINE_HOOK_AGAIN(0x5025F0, HouseClass_RegisterGain, 0x5) // RegisterLoss
DEFINE_HOOK(0x502A80, HouseClass_RegisterGain, 0x8)
{
if (!Phobos::Config::UnitPowerDrain)
return 0;
GET(HouseClass*, pThis, ECX);
pThis->RecheckPower = true;
return 0;
}
DEFINE_HOOK(0x508D8D, HouseClass_UpdatePower_AfterBuildings, 0x6)
{
GET(HouseClass*, pThis, ESI);
if (Phobos::Config::UnitPowerDrain)
{
auto updateDrainForThisType = [pThis](const TechnoTypeClass* pType)
{
const int count = pThis->CountOwnedAndPresent(pType);
if (count == 0)
return;
const auto pExt = TechnoTypeExt::ExtMap.Find(pType);
if (pExt->Power > 0)
pThis->PowerOutput += pExt->Power * count;
else
pThis->PowerDrain -= pExt->Power * count;
};
for (const auto pType : InfantryTypeClass::Array)
updateDrainForThisType(pType);
for (const auto pType : UnitTypeClass::Array)
updateDrainForThisType(pType);
for (const auto pType : AircraftTypeClass::Array)
updateDrainForThisType(pType);
// Don't do this for buildings, they've already been counted.
}
HouseExt::CalculatePowerSurplus(pThis);
return 0;
}
DEFINE_HOOK(0x73E474, UnitClass_Unload_Storage, 0x6)
{
GET(BuildingClass* const, pBuilding, EDI);
GET(int const, idxTiberium, EBP);
REF_STACK(float, amount, 0x1C);
auto const pTypeExt = BuildingTypeExt::ExtMap.Find(pBuilding->Type);
auto const storageTiberiumIndex = RulesExt::Global()->Storage_TiberiumIndex;
if (pTypeExt->Refinery_UseStorage && storageTiberiumIndex >= 0)
{
BuildingExt::StoreTiberium(pBuilding, amount, idxTiberium, storageTiberiumIndex);
amount = 0.0f;
}
return 0;
}
namespace RecalcCenterTemp
{
HouseExt::ExtData* pExtData;
}
DEFINE_HOOK(0x4FD166, HouseClass_RecalcCenter_SetContext, 0x5)
{
GET(HouseClass* const, pThis, EDI);
RecalcCenterTemp::pExtData = HouseExt::ExtMap.Find(pThis);
return 0;
}
DEFINE_HOOK_AGAIN(0x4FD463, HouseClass_RecalcCenter_LimboDelivery, 0x6)
DEFINE_HOOK(0x4FD1CD, HouseClass_RecalcCenter_LimboDelivery, 0x6)
{
enum { SkipBuilding1 = 0x4FD23B, SkipBuilding2 = 0x4FD4D5 };
GET(BuildingClass* const, pBuilding, ESI);
if (!MapClass::Instance.CoordinatesLegal(pBuilding->GetMapCoords())
|| (RecalcCenterTemp::pExtData && RecalcCenterTemp::pExtData->OwnsLimboDeliveredBuilding(pBuilding))
|| TechnoTypeExt::ExtMap.Find(pBuilding->Type)->IgnoreForBaseCenter)
{
return R->Origin() == 0x4FD1CD ? SkipBuilding1 : SkipBuilding2;
}
return 0;
}
DEFINE_HOOK(0x4AC534, DisplayClass_ComputeStartPosition_IllegalCoords, 0x6)
{
enum { SkipTechno = 0x4AC55B };
GET(TechnoClass* const, pTechno, ECX);
if (!MapClass::Instance.CoordinatesLegal(pTechno->GetMapCoords()) || TechnoExt::ExtMap.Find(pTechno)->TypeExtData->IgnoreForBaseCenter)
return SkipTechno;
return 0;
}
#pragma region LimboTracking
// These hooks handle tracking objects that are limboed e.g not physically on the map or engaged in game logic updates.
// The objects are manually updated once after pre-placed objects have been parsed, buildings are ignored as the limboed pre-placed buildings
// are not relevant (walls that will be converted into overlays etc), after which automatic update on limbo/unlimbo and uninit is enabled.
namespace LimboTrackingTemp
{
bool Enabled = false;
int IsBeingDeleted = 0;
}
DEFINE_HOOK(0x687B18, ScenarioClass_ReadINI_StartTracking, 0x7)
{
for (auto const pTechno : TechnoClass::Array)
{
auto const pType = pTechno->GetTechnoType();
if (!pType->Insignificant && !pType->DontScore && pTechno->WhatAmI() != AbstractType::Building && pTechno->InLimbo)
{
auto const pOwnerExt = HouseExt::ExtMap.Find(pTechno->Owner);
pOwnerExt->AddToLimboTracking(pType);
}
}
LimboTrackingTemp::Enabled = true;
return 0;
}
static void __fastcall TechnoClass_UnInit_Wrapper(TechnoClass* pThis)
{
if (LimboTrackingTemp::Enabled && pThis->InLimbo)
{
auto const pType = pThis->GetTechnoType();
if (!pType->Insignificant && !pType->DontScore)
HouseExt::ExtMap.Find(pThis->Owner)->RemoveFromLimboTracking(pType);
}
++LimboTrackingTemp::IsBeingDeleted;
pThis->ObjectClass::UnInit();
--LimboTrackingTemp::IsBeingDeleted;
}
DEFINE_FUNCTION_JUMP(CALL, 0x4DE60B, TechnoClass_UnInit_Wrapper); // FootClass
DEFINE_FUNCTION_JUMP(VTABLE, 0x7E3FB4, TechnoClass_UnInit_Wrapper); // BuildingClass
DEFINE_HOOK(0x6F6BC9, TechnoClass_Limbo_AddTracking, 0x6)
{
GET(TechnoClass* const, pThis, ESI);
auto const pType = pThis->GetTechnoType();
if (LimboTrackingTemp::Enabled && !pType->Insignificant && !pType->DontScore && !LimboTrackingTemp::IsBeingDeleted)
{
auto const pOwnerExt = HouseExt::ExtMap.Find(pThis->Owner);
pOwnerExt->AddToLimboTracking(pType);
}
return 0;
}
DEFINE_HOOK(0x6F6D85, TechnoClass_Unlimbo_RemoveTracking, 0x6)
{
GET(TechnoClass* const, pThis, ESI);
auto const pType = pThis->GetTechnoType();
auto const pExt = TechnoExt::ExtMap.Find(pThis);
if (LimboTrackingTemp::Enabled && !pType->Insignificant && !pType->DontScore && pExt->HasBeenPlacedOnMap)
{
auto const pOwnerExt = HouseExt::ExtMap.Find(pThis->Owner);
pOwnerExt->RemoveFromLimboTracking(pType);
}
else if (!pExt->HasBeenPlacedOnMap)
{
pExt->HasBeenPlacedOnMap = true;
if (pExt->TypeExtData->AutoDeath_Behavior.isset())
ScenarioExt::Global()->AutoDeathObjects.push_back(pExt);
}
return 0;
}
DEFINE_HOOK(0x7015C9, TechnoClass_Captured_UpdateTracking, 0x6)
{
GET(TechnoClass* const, pThis, ESI);
GET(HouseClass* const, pNewOwner, EBP);
auto const pExt = TechnoExt::ExtMap.Find(pThis);
auto const pTypeExt = pExt->TypeExtData;
if (pTypeExt->AutoDeath_Behavior.isset())
{
const bool humanToComputer = pTypeExt->AutoDeath_OnOwnerChange_HumanToComputer.Get(pTypeExt->AutoDeath_OnOwnerChange);
const bool computerToHuman = pTypeExt->AutoDeath_OnOwnerChange_ComputerToHuman.Get(pTypeExt->AutoDeath_OnOwnerChange);
if (humanToComputer && computerToHuman)
{
TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive);
return 0;
}
else if (humanToComputer || computerToHuman)
{
const bool I_am_human = pThis->Owner->IsControlledByHuman();
if (I_am_human != pNewOwner->IsControlledByHuman())
{
if ((I_am_human && humanToComputer) || (!I_am_human && computerToHuman))
{
TechnoExt::KillSelf(pThis, pTypeExt->AutoDeath_Behavior, pTypeExt->AutoDeath_VanishAnimation, !pThis->IsInLogic && pThis->IsAlive);
return 0;
}
}
}
}
auto const pType = pTypeExt->OwnerObject();
auto const pOwnerExt = HouseExt::ExtMap.Find(pThis->Owner);
auto const pNewOwnerExt = HouseExt::ExtMap.Find(pNewOwner);
if (LimboTrackingTemp::Enabled && !pType->Insignificant && !pType->DontScore && pThis->InLimbo)
{
pOwnerExt->RemoveFromLimboTracking(pType);
pNewOwnerExt->AddToLimboTracking(pType);
}
if (pTypeExt->Harvester_Counted)
{
auto& vec = pOwnerExt->OwnedCountedHarvesters;
vec.erase(std::remove(vec.begin(), vec.end(), pThis), vec.end());
pNewOwnerExt->OwnedCountedHarvesters.push_back(pThis);
}
if (const auto pMe = generic_cast<FootClass*, true>(pThis))
{
const bool I_am_human = pThis->Owner->IsControlledByHuman();
if (I_am_human != pNewOwner->IsControlledByHuman())
{
if (const auto pConvertTo = I_am_human
? pTypeExt->Convert_HumanToComputer.Get()
: pTypeExt->Convert_ComputerToHuman.Get())
{
if (pConvertTo->WhatAmI() == pType->WhatAmI())
TechnoExt::ConvertToType(pMe, pConvertTo);
}
if (!I_am_human)
TechnoExt::ChangeOwnerMissionFix(pMe);
}
pThis->Owner->RecheckTechTree = true;
pNewOwner->RecheckTechTree = true;
}
for (const auto& pTrail : pExt->LaserTrails)
{
if (pTrail->Type->IsHouseColor)
pTrail->CurrentColor = pNewOwner->LaserColor;
}
return 0;
}
#pragma endregion
DEFINE_HOOK(0x65EB8D, HouseClass_SendSpyPlanes_PlaceAircraft, 0x6)
{
enum { SkipGameCode = 0x65EBE5, SkipGameCodeNoSuccess = 0x65EC12 };
GET(AircraftClass* const, pAircraft, ESI);
GET(CellStruct const, edgeCell, EDI);
const bool result = AircraftExt::PlaceReinforcementAircraft(pAircraft, edgeCell);
return result ? SkipGameCode : SkipGameCodeNoSuccess;
}
DEFINE_HOOK(0x65E997, HouseClass_SendAirstrike_PlaceAircraft, 0x6)
{
enum { SkipGameCode = 0x65E9EE, SkipGameCodeNoSuccess = 0x65EA8B };
GET(AircraftClass* const, pAircraft, ESI);
GET(CellStruct const, edgeCell, EDI);
const bool result = AircraftExt::PlaceReinforcementAircraft(pAircraft, edgeCell);
return result ? SkipGameCode : SkipGameCodeNoSuccess;
}
// Vanilla and Ares all only hardcoded to find factory with BuildCat::DontCare...
static inline bool CheckShouldDisableDefensesCameo(HouseClass* pHouse, TechnoTypeClass* pType)
{
if (const auto pBuildingType = abstract_cast<BuildingTypeClass*>(pType))
{
if (pBuildingType->BuildCat == BuildCat::Combat)
{
auto count = 0;
if (const auto pFactory = pHouse->Primary_ForDefenses)
{
count = pFactory->CountTotal(pBuildingType);
if (pFactory->Object && pFactory->Object->GetType() == pBuildingType && pBuildingType->BuildLimit > 0)
--count;
}
auto buildLimitRemaining = [](HouseClass* pHouse, BuildingTypeClass* pBldType)
{
const auto BuildLimit = pBldType->BuildLimit;
if (BuildLimit >= 0)
return BuildLimit - BuildingTypeExt::CountOwnedNowWithDeployOrUpgrade(pBldType, pHouse);
else
return -BuildLimit - pHouse->CountOwnedEver(pBldType);
};
if (buildLimitRemaining(pHouse, pBuildingType) - count <= 0)
return true;
}
}
return false;
}
DEFINE_HOOK(0x50B669, HouseClass_ShouldDisableCameo_GreyCameo, 0x5)
{
GET(HouseClass*, pThis, ECX);
GET_STACK(TechnoTypeClass*, pType, 0x4);
GET(const bool, aresDisable, EAX);
if (aresDisable || !pType)
return 0;
if (CheckShouldDisableDefensesCameo(pThis, pType) || HouseExt::ReachedBuildLimit(pThis, pType, false))
R->EAX(true);
return 0;
}
DEFINE_HOOK(0x4FD77C, HouseClass_ExpertAI_Superweapons, 0x5)
{
enum { SkipSWProcess = 0x4FD7A0 };
if (RulesExt::Global()->AISuperWeaponDelay.isset())
return SkipSWProcess;
return 0;
}
DEFINE_HOOK(0x4F9038, HouseClass_AI_Superweapons, 0x5)
{
GET(HouseClass*, pThis, ESI);
if (!RulesExt::Global()->AISuperWeaponDelay.isset() || pThis->IsControlledByHuman() || pThis->Type->MultiplayPassive)
return 0;
const int delay = RulesExt::Global()->AISuperWeaponDelay.Get();
auto const pExt = HouseExt::ExtMap.Find(pThis);
if (delay > 0)
{
if (pExt->AISuperWeaponDelayTimer.HasTimeLeft())
return 0;
pExt->AISuperWeaponDelayTimer.Start(delay);
}
if (!SessionClass::IsCampaign() || pThis->IQLevel2 >= RulesClass::Instance->SuperWeapons)
pThis->AI_TryFireSW();
if (pExt->MusicDuration.Completed())
pExt->MusicStop();
return 0;
}
DEFINE_HOOK_AGAIN(0x4FFA99, HouseClass_ExcludeFromMultipleFactoryBonus, 0x6)
DEFINE_HOOK(0x4FF9C9, HouseClass_ExcludeFromMultipleFactoryBonus, 0x6)
{
GET(BuildingClass*, pBuilding, ESI);
auto const pType = pBuilding->Type;
if (BuildingTypeExt::ExtMap.Find(pType)->ExcludeFromMultipleFactoryBonus)
{
GET(HouseClass*, pThis, EDI);
GET(const bool, isNaval, ECX);
auto const pExt = HouseExt::ExtMap.Find(pThis);
pExt->UpdateNonMFBFactoryCounts(pType->Factory, R->Origin() == 0x4FF9C9, isNaval);
}
return 0;
}
DEFINE_HOOK(0x500910, HouseClass_GetFactoryCount, 0x5)
{
enum { SkipGameCode = 0x50095D };
GET(HouseClass*, pThis, ECX);
GET_STACK(AbstractType, rtti, 0x4);
GET_STACK(const bool, isNaval, 0x8);
auto const pExt = HouseExt::ExtMap.Find(pThis);
R->EAX(pExt->GetFactoryCountWithoutNonMFB(rtti, isNaval));
return SkipGameCode;
}
// Sell all and all in.
DEFINE_HOOK(0x4FD8F7, HouseClass_UpdateAI_OnLastLegs, 0x10)
{
enum { ret = 0x4FD907 };
GET(HouseClass*, pThis, EBX);
if (RulesExt::Global()->AIFireSale)
{
auto const pExt = HouseExt::ExtMap.Find(pThis);
if (RulesExt::Global()->AIFireSaleDelay <= 0 || pExt->AIFireSaleDelayTimer.Completed())
pThis->Fire_Sale();
else if (!pExt->AIFireSaleDelayTimer.HasStarted())
pExt->AIFireSaleDelayTimer.Start(RulesExt::Global()->AIFireSaleDelay);
}
if (RulesExt::Global()->AIAllToHunt)
pThis->All_To_Hunt();
return ret;
}
DEFINE_HOOK(0x4F8ACC, HouseClass_Update_ResetTeamDelay, 0x6)
{
enum { ResetTeamDelay = 0x4F8AD5 };
GET(HouseClass*, pThis, ESI);
const int teamDelay = HouseExt::ExtMap.Find(pThis)->TeamDelay;
if (teamDelay >= 0)
{
R->ECX(teamDelay);
return ResetTeamDelay;
}
return 0;
}
DEFINE_HOOK(0x508E17, HouseClass_UpdateRadar_FreeRadar, 0x8)
{
enum { ForceRadar = 0x508F2F, Continue = 0x508E4A };
GET(HouseClass*, pThis, ECX);
REF_STACK(bool, enableRadar, STACK_OFFSET(0x1C, -0xC));
auto const pExt = HouseExt::ExtMap.Find(pThis);
bool const freeRadar = pExt->FreeRadar;
enableRadar = false;
if (pExt->ForceRadar)
{
enableRadar = freeRadar;
return ForceRadar;
}
else if (pThis->RadarBlackoutTimer.HasTimeLeft())
{
return ForceRadar;
}
else if (freeRadar)
{
enableRadar = true;
return ForceRadar;
}
return Continue;
}
// WW's code set anger on every houses, even on the allies.
DEFINE_HOOK(0x4FD616, HouseClass_UpdateAI_DontAngerOnAlly, 0x9)
{
enum { SkipCurrentHouse = 0x4FD6FE };
GET(HouseClass*, pThis, EBX);
GET(HouseClass*, pTargetHouse, ESI);
return pThis->IsAlliedWith(pTargetHouse) ? SkipCurrentHouse : 0;
}
// WW calculates the distance from pThis to pThis ...
DEFINE_HOOK(0x4FD635, HouseClass_UpdateAI_DistCalcFix, 0x5)
{
enum { SkipGameCode = 0x4FD657 };
GET(HouseClass*, pTargetHouse, ESI);
auto baseMapCrd = pTargetHouse->BaseCenter == CellStruct::Empty ? pTargetHouse->BaseSpawnCell : pTargetHouse->BaseCenter;
R->EAX(*(int*)&baseMapCrd);
return SkipGameCode;
}
// Replace game function.
DEFINE_HOOK(0x50BF60, HouseClass_CalculateCostMultipliers, 0x5)
{
enum { SkipGameCode = 0x50C04A };
GET(HouseClass*, pThis, ECX);
std::unordered_map<int, int> counts;
pThis->CostAircraftMult = 1.0f;
pThis->CostBuildingsMult = 1.0f;
pThis->CostDefensesMult = 1.0f;
pThis->CostInfantryMult = 1.0f;
pThis->CostUnitsMult = 1.0f;
for (auto const& pBuilding : pThis->FactoryPlants)
{
auto const pType = pBuilding->Type;
auto const pTypeExt = BuildingTypeExt::ExtMap.Find(pType);
const int max = pTypeExt->FactoryPlant_MaxCount;
if (max > -1 && counts[pType->ArrayIndex] >= max)
continue;
counts[pType->ArrayIndex]++;
pThis->CostAircraftMult *= pType->AircraftCostBonus;
pThis->CostBuildingsMult *= pType->BuildingsCostBonus;
pThis->CostDefensesMult *= pType->DefensesCostBonus;
pThis->CostInfantryMult *= pType->InfantryCostBonus;
pThis->CostUnitsMult *= pType->UnitsCostBonus;
}
return SkipGameCode;
}
#pragma region PlayerAutoRepair
DEFINE_HOOK(0x6A5395, SidebarClass_InitIO_InitRepairButton, 0x6)
{
if (!RulesExt::Global()->ExtendedPlayerRepair)
return 0;
if (HouseExt::ExtMap.Find(HouseClass::CurrentPlayer)->PlayerAutoRepair)
{
SidebarClass::Instance.SidebarNeedsRedraw = true;
SidebarClass::ToggleRepairButton.IsOn = true;
}
return 0;
}
DEFINE_HOOK(0x536FA0, ToggleRepariModeCommandClass_Execute_PlayerAutoRepair, 0x7)
{
if (!RulesExt::Global()->ExtendedPlayerRepair)
return 0;
EventExt::RaiseTogglePlayerAutoRepair();
return 0x536FAC;
}
DEFINE_HOOK(0x6A78F6, SidebarClass_Update_ToggleRepair, 0x9)
{
if (!RulesExt::Global()->ExtendedPlayerRepair)
MapClass::Instance.SetRepairMode(-1);
else
EventExt::RaiseTogglePlayerAutoRepair();
return 0x6A78FF;
}
DEFINE_HOOK(0x6A7AE1, SidebarClass_Update_RepairButton, 0x6)
{
if (!RulesExt::Global()->ExtendedPlayerRepair)
return 0;
R->AL(HouseExt::ExtMap.Find(HouseClass::CurrentPlayer)->PlayerAutoRepair);
return 0x6A7AE7;
}
DEFINE_HOOK(0x45063F, BuildingClass_UpdateRepairSell_PlayerAutoRepair, 0x6)
{
enum { CanAutoRepair = 0x450659, CanNotAutoRepair = 0x450813 };
if (!RulesExt::Global()->ExtendedPlayerRepair)
return 0;
GET(BuildingClass*, pThis, ESI);
if (!pThis->Owner->IsControlledByHuman())
return 0;
if (HouseExt::ExtMap.Find(pThis->Owner)->PlayerAutoRepair)
{
return CanAutoRepair;
}
else
{
if (pThis->IsBeingRepaired)
pThis->SetRepairState(0);
return CanNotAutoRepair;
}
}
#pragma endregion