@@ -17,6 +17,7 @@ DEFINE_HOOK(0x6F348F, TechnoClass_WhatWeaponShouldIUse_Airstrike, 0x7)
17
17
return Primary;
18
18
19
19
GET (WarheadTypeClass*, pSecondaryWH, ECX);
20
+
20
21
const auto pWHExt = WarheadTypeExt::ExtMap.Find (pSecondaryWH);
21
22
22
23
if (!EnumFunctions::IsTechnoEligible (pTargetTechno, pWHExt->AirstrikeTargets ))
@@ -27,10 +28,12 @@ DEFINE_HOOK(0x6F348F, TechnoClass_WhatWeaponShouldIUse_Airstrike, 0x7)
27
28
if (pTargetTechno->AbstractFlags & AbstractFlags::Foot)
28
29
{
29
30
const auto pTargetTypeExt = TechnoTypeExt::ExtMap.Find (pTargetType);
31
+
30
32
return pTargetTypeExt->AllowAirstrike .Get (true ) ? Secondary : Primary;
31
33
}
32
34
33
35
const auto pTargetTypeExt = TechnoTypeExt::ExtMap.Find (pTargetType);
36
+
34
37
return pTargetTypeExt->AllowAirstrike .Get (static_cast <BuildingTypeClass*>(pTargetType)->CanC4 ) && (!pTargetType->ResourceDestination || !pTargetType->ResourceGatherer ) ? Secondary : Primary;
35
38
}
36
39
@@ -40,8 +43,8 @@ DEFINE_HOOK(0x41D97B, AirstrikeClass_Fire_SetAirstrike, 0x7)
40
43
41
44
GET (AirstrikeClass*, pThis, EDI);
42
45
GET (TechnoClass*, pTarget, ESI);
43
- const auto pTargetExt = TechnoExt::ExtMap. Find (pTarget);
44
- pTargetExt ->AirstrikeTargetingMe = pThis;
46
+
47
+ TechnoExt::ExtMap. Find (pTarget) ->AirstrikeTargetingMe = pThis;
45
48
pTarget->StartAirstrikeTimer (100000 );
46
49
47
50
return pTarget->WhatAmI () == AbstractType::Building ? ContinueIn : Skip;
@@ -70,8 +73,8 @@ DEFINE_HOOK(0x41DAA4, AirstrikeClass_ResetTarget_ResetForOldTarget, 0xA)
70
73
enum { SkipGameCode = 0x41DAAE };
71
74
72
75
GET (TechnoClass*, pTargetTechno, EDI);
73
- const auto pTargetExt = TechnoExt::ExtMap. Find (pTargetTechno);
74
- pTargetExt ->AirstrikeTargetingMe = nullptr ;
76
+
77
+ TechnoExt::ExtMap. Find (pTargetTechno) ->AirstrikeTargetingMe = nullptr ;
75
78
76
79
return SkipGameCode;
77
80
}
@@ -82,8 +85,8 @@ DEFINE_HOOK(0x41DAD4, AirstrikeClass_ResetTarget_ResetForNewTarget, 0x6)
82
85
83
86
GET (AirstrikeClass*, pThis, EBP);
84
87
GET (TechnoClass*, pTargetTechno, ESI);
85
- const auto pTargetExt = TechnoExt::ExtMap. Find (pTargetTechno);
86
- pTargetExt ->AirstrikeTargetingMe = pThis;
88
+
89
+ TechnoExt::ExtMap. Find (pTargetTechno) ->AirstrikeTargetingMe = pThis;
87
90
88
91
return SkipGameCode;
89
92
}
@@ -111,8 +114,7 @@ DEFINE_HOOK(0x41DBD4, AirstrikeClass_Stop_ResetForTarget, 0x7)
111
114
}
112
115
}
113
116
114
- const auto pTargetExt = TechnoExt::ExtMap.Find (pTargetTechno);
115
- pTargetExt->AirstrikeTargetingMe = pLastTargetingMe;
117
+ TechnoExt::ExtMap.Find (pTargetTechno)->AirstrikeTargetingMe = pLastTargetingMe;
116
118
117
119
if (!pLastTargetingMe && Game::IsActive)
118
120
pTarget->Mark (MarkType::Change);
@@ -127,8 +129,8 @@ DEFINE_HOOK(0x41D604, AirstrikeClass_PointerGotInvalid_ResetForTarget, 0x6)
127
129
128
130
GET (ObjectClass*, pTarget, EAX);
129
131
130
- if (const auto pTargetTechno = abstract_cast<TechnoClass*>(pTarget))
131
- TechnoExt::ExtMap. Find (pTargetTechno) ->AirstrikeTargetingMe = nullptr ;
132
+ if (const auto pTargetTechnoExt = TechnoExt::ExtMap. Find ( abstract_cast<TechnoClass*>(pTarget) ))
133
+ pTargetTechnoExt ->AirstrikeTargetingMe = nullptr ;
132
134
133
135
return SkipGameCode;
134
136
}
@@ -138,6 +140,7 @@ DEFINE_HOOK(0x65E97F, HouseClass_CreateAirstrike_SetTaretForUnit, 0x6)
138
140
enum { SkipGameCode = 0x65E992 };
139
141
140
142
GET_STACK (AirstrikeClass*, pThis, STACK_OFFSET (0x38 , 0x1C ));
143
+
141
144
const auto pOwner = pThis->Owner ;
142
145
143
146
if (!pOwner || !pOwner->Target )
@@ -146,7 +149,9 @@ DEFINE_HOOK(0x65E97F, HouseClass_CreateAirstrike_SetTaretForUnit, 0x6)
146
149
if (const auto pTarget = abstract_cast<TechnoClass*>(pOwner->Target ))
147
150
{
148
151
GET (AircraftClass*, pFirer, ESI);
152
+
149
153
pFirer->SetTarget (pTarget);
154
+
150
155
return SkipGameCode;
151
156
}
152
157
@@ -166,6 +171,7 @@ DEFINE_HOOK(0x51EAE0, TechnoClass_WhatAction_AllowAirstrike, 0x7)
166
171
if (const auto pBuilding = abstract_cast<BuildingClass*>(pTechno))
167
172
{
168
173
const auto pBuildingType = pBuilding->Type ;
174
+
169
175
return pTypeExt->AllowAirstrike .Get (pBuildingType->CanC4 ) && !pBuildingType->InvisibleInGame ? CanAirstrike : Cannot;
170
176
}
171
177
else
@@ -181,9 +187,9 @@ DEFINE_HOOK(0x70782D, TechnoClass_PointerGotInvalid_Airstrike, 0x6)
181
187
{
182
188
GET (TechnoClass*, pThis, ESI);
183
189
GET (AbstractClass*, pAbstract, EBP);
184
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
185
190
186
- AnnounceInvalidPointer (pExt->AirstrikeTargetingMe , pAbstract);
191
+ if (const auto pExt = TechnoExt::ExtMap.Find (pThis)) // It's necessary
192
+ AnnounceInvalidPointer (pExt->AirstrikeTargetingMe , pAbstract);
187
193
188
194
return 0 ;
189
195
}
@@ -195,19 +201,17 @@ DEFINE_HOOK(0x70E92F, TechnoClass_UpdateAirstrikeTint, 0x5)
195
201
enum { ContinueIn = 0x70E96E , Skip = 0x70EC9F };
196
202
197
203
GET (TechnoClass*, pThis, ESI);
198
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
199
204
200
- return pExt ->AirstrikeTargetingMe ? ContinueIn : Skip;
205
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueIn : Skip;
201
206
}
202
207
203
208
DEFINE_HOOK (0x43FDD6 , BuildingClass_AI_Airstrike, 0x6 )
204
209
{
205
210
enum { SkipGameCode = 0x43FDF1 };
206
211
207
212
GET (BuildingClass*, pThis, ESI);
208
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
209
213
210
- if (pExt ->AirstrikeTargetingMe )
214
+ if (TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe )
211
215
pThis->Mark (MarkType::Change);
212
216
213
217
return SkipGameCode;
@@ -218,59 +222,53 @@ DEFINE_HOOK(0x43F9E0, BuildingClass_Mark_Airstrike, 0x6)
218
222
enum { ContinueTintIntensity = 0x43FA0F , NonAirstrike = 0x43FA19 };
219
223
220
224
GET (BuildingClass*, pThis, EDI);
221
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
222
225
223
- return pExt ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
226
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
224
227
}
225
228
226
229
DEFINE_HOOK (0x448DF1 , BuildingClass_SetOwningHouse_Airstrike, 0x6 )
227
230
{
228
231
enum { ContinueTintIntensity = 0x448E0D , NonAirstrike = 0x448E17 };
229
232
230
233
GET (BuildingClass*, pThis, ESI);
231
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
232
234
233
- return pExt ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
235
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
234
236
}
235
237
236
238
DEFINE_HOOK (0x451ABC , BuildingClass_PlayAnim_Airstrike, 0x6 )
237
239
{
238
240
enum { ContinueTintIntensity = 0x451AEB , NonAirstrike = 0x451AF5 };
239
241
240
242
GET (BuildingClass*, pThis, ESI);
241
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
242
243
243
- return pExt ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
244
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
244
245
}
245
246
246
247
DEFINE_HOOK (0x452041 , BuildingClass_452000_Airstrike, 0x6 )
247
248
{
248
249
enum { ContinueTintIntensity = 0x452070 , NonAirstrike = 0x45207A };
249
250
250
251
GET (BuildingClass*, pThis, ESI);
251
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
252
252
253
- return pExt ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
253
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
254
254
}
255
255
256
256
DEFINE_HOOK (0x456E5A , BuildingClass_Flash_Airstrike, 0x6 )
257
257
{
258
258
enum { ContinueTintIntensity = 0x456E89 , NonAirstrike = 0x456E93 };
259
259
260
260
GET (BuildingClass*, pThis, ESI);
261
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
262
261
263
- return pExt ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
262
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
264
263
}
265
264
266
265
DEFINE_HOOK (0x456FD3 , BuildingClass_GetEffectTintIntensity_Airstrike, 0x6 )
267
266
{
268
267
enum { ContinueTintIntensity = 0x457002 , NonAirstrike = 0x45700F };
269
268
270
269
GET (BuildingClass*, pThis, ESI);
271
- const auto pExt = TechnoExt::ExtMap.Find (pThis);
272
270
273
- return pExt ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
271
+ return TechnoExt::ExtMap. Find (pThis) ->AirstrikeTargetingMe ? ContinueTintIntensity : NonAirstrike;
274
272
}
275
273
276
274
#pragma endregion
0 commit comments