Skip to content

Commit 80317c2

Browse files
committed
fix AE attach broken by c434b7b & some fixup in codes and docs
1 parent a21de16 commit 80317c2

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

docs/Fixed-or-Improved-Logics.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
274274
- Allow Reveal Crate to take effect when picking up by another player controlled house in campaign.
275275
- Fixed an issue where the vanilla script ignores jumpjets. Enable it through `[General] -> AIAirTargetingFix=true`.
276276
- Fixed the bug that naval ship will sink even they destroyed in air.
277-
- Fixed the issue that units will goto farest location if target is closer than `MinimumRange`
277+
- Fixed MPDebug timer displaying when debug's visibility is off.
278+
- Fixed the issue that units will goto farest location if target is closer than `MinimumRange`.
278279

279280
## Fixes / interactions with other extensions
280281

src/Ext/House/Body.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ bool HouseExt::ExtData::UpdateHarvesterProduction()
204204
return false;
205205
}
206206

207-
bool HouseExt::ExtData::OwnsLimboDeliveredBuilding(BuildingClass* pBuilding)
207+
bool HouseExt::ExtData::OwnsLimboDeliveredBuilding(BuildingClass* pBuilding) const
208208
{
209209
if (!pBuilding)
210210
return false;
@@ -449,7 +449,7 @@ void HouseExt::ExtData::RemoveFromLimboTracking(TechnoTypeClass* pTechnoType)
449449
}
450450
}
451451

452-
int HouseExt::ExtData::CountOwnedPresentAndLimboed(TechnoTypeClass* pTechnoType)
452+
int HouseExt::ExtData::CountOwnedPresentAndLimboed(TechnoTypeClass* pTechnoType) const
453453
{
454454
int count = this->OwnerObject()->CountOwnedAndPresent(pTechnoType);
455455
const int arrayIndex = pTechnoType->GetArrayIndex();
@@ -505,7 +505,7 @@ void HouseExt::ExtData::UpdateNonMFBFactoryCounts(AbstractType rtti, bool remove
505505
*count += remove ? -1 : 1;
506506
}
507507

508-
int HouseExt::ExtData::GetFactoryCountWithoutNonMFB(AbstractType rtti, bool isNaval)
508+
int HouseExt::ExtData::GetFactoryCountWithoutNonMFB(AbstractType rtti, bool isNaval) const
509509
{
510510
auto const pThis = this->OwnerObject();
511511
int count = 0;

src/Ext/House/Body.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ class HouseExt
9797
, ForceEnemyIndex(-1)
9898
{ }
9999

100-
bool OwnsLimboDeliveredBuilding(BuildingClass* pBuilding);
100+
bool OwnsLimboDeliveredBuilding(BuildingClass* pBuilding) const;
101101
void AddToLimboTracking(TechnoTypeClass* pTechnoType);
102102
void RemoveFromLimboTracking(TechnoTypeClass* pTechnoType);
103-
int CountOwnedPresentAndLimboed(TechnoTypeClass* pTechnoType);
103+
int CountOwnedPresentAndLimboed(TechnoTypeClass* pTechnoType) const;
104104
void UpdateNonMFBFactoryCounts(AbstractType rtti, bool remove, bool isNaval);
105-
int GetFactoryCountWithoutNonMFB(AbstractType rtti, bool isNaval);
105+
int GetFactoryCountWithoutNonMFB(AbstractType rtti, bool isNaval) const;
106106
float GetRestrictedFactoryPlantMult(TechnoTypeClass* pTechnoType) const;
107107

108108
int GetForceEnemyIndex();

src/Ext/Techno/Hooks.Firing.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,8 @@ DEFINE_HOOK(0x6F36DB, TechnoClass_WhatWeaponShouldIUse, 0x8)
149149

150150
if (pSecondary
151151
&& (allowFallback
152-
|| (pTargetTechno
153-
&& ((allowAAFallback && pTargetTechno->IsInAir() && pSecondary->Projectile->AA)
154-
|| (pTargetTechno->InWhichLayer() == Layer::Underground && BulletTypeExt::ExtMap.Find(pSecondary->Projectile)->AU)))
152+
|| ((allowAAFallback && pTargetTechno->IsInAir() && pSecondary->Projectile->AA)
153+
|| (pTargetTechno->InWhichLayer() == Layer::Underground && BulletTypeExt::ExtMap.Find(pSecondary->Projectile)->AU))
155154
|| TechnoExt::CanFireNoAmmoWeapon(pThis, 1)))
156155
{
157156
if (!pShield->CanBeTargeted(pThis->GetWeapon(0)->WeaponType))

src/Ext/TechnoType/Body.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void TechnoTypeExt::ExtData::ApplyTurretOffset(Matrix3D* mtx, double factor)
2929
mtx->Translate(x, y, z);
3030
}
3131

32-
int TechnoTypeExt::ExtData::SelectForceWeapon(TechnoClass* pThis, AbstractClass* pTarget)
32+
int TechnoTypeExt::ExtData::SelectForceWeapon(TechnoClass* pThis, AbstractClass* pTarget) const
3333
{
3434
if (TechnoTypeExt::SelectWeaponMutex || !this->ForceWeapon_Check || !pTarget) // In theory, pTarget must exist
3535
return -1;
@@ -121,7 +121,7 @@ int TechnoTypeExt::ExtData::SelectForceWeapon(TechnoClass* pThis, AbstractClass*
121121
return forceWeaponIndex;
122122
}
123123

124-
bool TechnoTypeExt::ExtData::IsSecondary(int nWeaponIndex)
124+
bool TechnoTypeExt::ExtData::IsSecondary(int nWeaponIndex) const
125125
{
126126
const auto pThis = this->OwnerObject();
127127

@@ -137,7 +137,7 @@ bool TechnoTypeExt::ExtData::IsSecondary(int nWeaponIndex)
137137
return nWeaponIndex != 0;
138138
}
139139

140-
int TechnoTypeExt::ExtData::SelectMultiWeapon(TechnoClass* const pThis, AbstractClass* const pTarget)
140+
int TechnoTypeExt::ExtData::SelectMultiWeapon(TechnoClass* const pThis, AbstractClass* const pTarget) const
141141
{
142142
if (!pTarget || !this->MultiWeapon)
143143
return -1;

src/Ext/TechnoType/Body.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,10 @@ class TechnoTypeExt
855855

856856
void ApplyTurretOffset(Matrix3D* mtx, double factor = 1.0);
857857
void CalculateSpawnerRange();
858-
bool IsSecondary(int nWeaponIndex);
858+
bool IsSecondary(int nWeaponIndex) const;
859859

860-
int SelectForceWeapon(TechnoClass* pThis, AbstractClass* pTarget);
861-
int SelectMultiWeapon(TechnoClass* const pThis, AbstractClass* const pTarget);
860+
int SelectForceWeapon(TechnoClass* pThis, AbstractClass* pTarget) const;
861+
int SelectMultiWeapon(TechnoClass* const pThis, AbstractClass* const pTarget) const;
862862

863863
void UpdateAdditionalAttributes();
864864

src/Ext/TechnoType/Hooks.MultiWeapon.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ DEFINE_HOOK(0x6F398E, TechnoClass_CombatDamage_MultiWeapon, 0x7)
206206
return Continue;
207207
}
208208

209-
const auto pType = pThis->GetTechnoType();
210-
const auto pTypeExt = TechnoTypeExt::ExtMap.Find(pType);
209+
const auto pTypeExt = TechnoExt::ExtMap.Find(pThis)->TypeExtData;
210+
const auto pType = pTypeExt->OwnerObject();
211211

212212
if (rtti == AbstractType::Unit
213213
&& !pType->IsGattling && pType->TurretCount > 0

src/New/Entity/AttachEffectClass.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -709,18 +709,16 @@ AttachEffectClass* AttachEffectClass::CreateAndAttach(AttachEffectTypeClass* pTy
709709

710710
if (!cumulative)
711711
{
712-
match = attachEffect;
713-
break;
712+
attachEffect->RefreshDuration(attachParams.DurationOverride);
713+
AttachEffectTypeClass::HandleEvent(pTarget);
714+
return nullptr;
714715
}
715716
else if (!attachParams.CumulativeRefreshSameSourceOnly || (attachEffect->Source == pSource && attachEffect->Invoker == pInvoker))
716717
{
717718
cumulativeMatches.push_back(attachEffect);
718719

719720
if (!match || attachEffect->Duration < match->Duration)
720-
attachEffect->RefreshDuration(attachParams.DurationOverride);
721-
722-
AttachEffectTypeClass::HandleEvent(pTarget);
723-
return nullptr;
721+
match = attachEffect;
724722
}
725723
}
726724
}

0 commit comments

Comments
 (0)