@@ -49,13 +49,13 @@ void TechnoExt::ExtData::OnEarlyUpdate()
4949
5050void TechnoExt::ExtData::ApplyInterceptor ()
5151{
52- const auto pThis = this ->OwnerObject ();
5352 const auto pTypeExt = this ->TypeExtData ;
5453 const auto pInterceptorType = pTypeExt->InterceptorType .get ();
5554
5655 if (!pInterceptorType)
5756 return ;
5857
58+ const auto pThis = this ->OwnerObject ();
5959 const auto pTarget = pThis->Target ;
6060
6161 if (pTarget)
@@ -177,13 +177,13 @@ void TechnoExt::ExtData::ApplyInterceptor()
177177
178178void TechnoExt::ExtData::DepletedAmmoActions ()
179179{
180- auto const pThis = this ->OwnerObject ();
181180 auto const pTypeExt = this ->TypeExtData ;
182181 auto const pType = pTypeExt->OwnerObject ();
183182
184183 if (pType->Ammo <= 0 )
185184 return ;
186185
186+ auto const pThis = this ->OwnerObject ();
187187 auto const rtti = pThis->WhatAmI ();
188188 UnitClass* pUnit = nullptr ;
189189
@@ -206,8 +206,8 @@ void TechnoExt::ExtData::DepletedAmmoActions()
206206 return ;
207207
208208 int const ammo = pThis->Ammo ;
209- bool canDeploy = TechnoExt::HasAmmoToDeploy (pThis) && (min < 0 || ammo >= min) && (max < 0 || ammo <= max);
210- bool isDeploying = pThis->CurrentMission == Mission::Unload || pThis->QueuedMission == Mission::Unload;
209+ const bool canDeploy = TechnoExt::HasAmmoToDeploy (pThis) && (min < 0 || ammo >= min) && (max < 0 || ammo <= max);
210+ const bool isDeploying = pThis->CurrentMission == Mission::Unload || pThis->QueuedMission == Mission::Unload;
211211
212212 if (canDeploy && !isDeploying)
213213 {
@@ -234,13 +234,12 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
234234 return false ;
235235
236236 auto const pThis = this ->OwnerObject ();
237- auto const pType = pThis->GetTechnoType ();
238237
239238 // Self-destruction must be enabled
240239 const auto howToDie = pTypeExt->AutoDeath_Behavior .Get ();
241240
242241 // Death if no ammo
243- if (pType ->Ammo > 0 && pThis->Ammo <= 0 && pTypeExt->AutoDeath_OnAmmoDepletion )
242+ if (pTypeExt-> OwnerObject () ->Ammo > 0 && pThis->Ammo <= 0 && pTypeExt->AutoDeath_OnAmmoDepletion )
244243 {
245244 TechnoExt::KillSelf (pThis, howToDie, pTypeExt->AutoDeath_VanishAnimation , isInLimbo);
246245 return true ;
@@ -311,10 +310,14 @@ bool TechnoExt::ExtData::CheckDeathConditions(bool isInLimbo)
311310
312311void TechnoExt::ExtData::EatPassengers ()
313312{
314- auto const pThis = this ->OwnerObject ();
315313 auto const pTypeExt = this ->TypeExtData ;
316314
317- if (!pTypeExt->PassengerDeletionType || !TechnoExt::IsActiveIgnoreEMP (pThis))
315+ if (!pTypeExt->PassengerDeletionType )
316+ return ;
317+
318+ auto const pThis = this ->OwnerObject ();
319+
320+ if (!TechnoExt::IsActiveIgnoreEMP (pThis))
318321 return ;
319322
320323 auto const pDelType = pTypeExt->PassengerDeletionType .get ();
@@ -414,7 +417,7 @@ void TechnoExt::ExtData::EatPassengers()
414417 }
415418
416419 // Handle gunner change.
417- auto const pTransportType = pThis-> GetTechnoType ();
420+ auto const pTransportType = pTypeExt-> OwnerObject ();
418421
419422 if (pTransportType->Gunner )
420423 {
@@ -639,6 +642,13 @@ void TechnoExt::ExtData::UpdateTypeData(TechnoTypeClass* pCurrentType)
639642
640643 this ->UpdateSelfOwnedAttachEffects ();
641644
645+ if (auto const pShield = this ->Shield .get ())
646+ pShield->ConvertCheck (pCurrentType);
647+
648+ // Recalculate and redraw
649+ this ->UpdateTintValues ();
650+ pThis->MarkForRedraw ();
651+
642652 // Recreate Laser Trails
643653 if (const size_t trailCount = this ->LaserTrails .size ())
644654 {
@@ -1317,6 +1327,7 @@ void TechnoExt::ExtData::UpdateLaserTrails()
13171327void TechnoExt::ExtData::UpdateMindControlAnim ()
13181328{
13191329 auto const pThis = this ->OwnerObject ();
1330+
13201331 if (pThis->IsMindControlled ())
13211332 {
13221333 if (pThis->MindControlRingAnim && !this ->MindControlRingAnimType )
@@ -1390,9 +1401,7 @@ void TechnoExt::ExtData::UpdateGattlingRateDownReset()
13901401 this ->ShouldUpdateGattlingValue = false ;
13911402
13921403 if (oldStage != 0 )
1393- {
13941404 pThis->GattlingRateDown (0 );
1395- }
13961405 }
13971406 }
13981407}
@@ -1865,7 +1874,6 @@ void TechnoExt::ExtData::UpdateSelfOwnedAttachEffects()
18651874 auto const pTypeExt = this ->TypeExtData ;
18661875 std::vector<std::unique_ptr<AttachEffectClass>>::iterator it;
18671876 std::vector<std::pair<WeaponTypeClass*, TechnoClass*>> expireWeapons;
1868- bool markForRedraw = false ;
18691877 bool altered = false ;
18701878
18711879 // Delete ones on old type and not on current.
@@ -1894,7 +1902,6 @@ void TechnoExt::ExtData::UpdateSelfOwnedAttachEffects()
18941902 }
18951903 }
18961904
1897- markForRedraw |= pType->HasTint ();
18981905 it = this ->AttachedEffects .erase (it);
18991906 altered = true ;
19001907 }
@@ -1917,9 +1924,6 @@ void TechnoExt::ExtData::UpdateSelfOwnedAttachEffects()
19171924
19181925 if (altered && !count)
19191926 this ->RecalculateStatMultipliers ();
1920-
1921- if (markForRedraw)
1922- pThis->MarkForRedraw ();
19231927}
19241928
19251929// Updates CumulativeAnimations AE's on techno.
0 commit comments