Skip to content

Commit 3adccd8

Browse files
committed
bugfix: Sniper weapons can no longer fire upon empty Stinger Sites
1 parent 81fffb3 commit 3adccd8

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ class SpawnBehaviorInterface
122122
virtual Bool areAllSlavesStealthed() const = 0;
123123
virtual void revealSlaves() = 0;
124124
virtual Bool doSlavesHaveFreedom() const = 0;
125+
virtual Int getSlaveCount() const = 0;
125126
};
126127

127128
// ------------------------------------------------------------------------------------------------
@@ -177,6 +178,7 @@ class SpawnBehavior : public UpdateModule,
177178
virtual Bool areAllSlavesStealthed() const override;
178179
virtual void revealSlaves() override;
179180
virtual Bool doSlavesHaveFreedom() const override { return getSpawnBehaviorModuleData()->m_slavesHaveFreeWill; }
181+
virtual Int getSlaveCount() const override { return m_spawnCount; }
180182

181183
// **********************************************************************************************
182184
// our own methods

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#include "GameLogic/Module/AssistedTargetingUpdate.h"
7575
#include "GameLogic/Module/ProjectileStreamUpdate.h"
7676
#include "GameLogic/Module/PhysicsUpdate.h"
77+
#include "GameLogic/Module/SpawnBehavior.h"
7778
#include "GameLogic/TerrainLogic.h"
7879

7980
#define RATIONALIZE_ATTACK_RANGE
@@ -604,6 +605,15 @@ Real WeaponTemplate::estimateWeaponTemplateDamage(
604605
if ( victimObj->getContain()->getContainCount() == 0 )
605606
return 0.0f;
606607
}
608+
#if !RETAIL_COMPATIBLE_CRC
609+
else
610+
{
611+
// TheSuperHackers @bugfix Stubbjax 22/06/2026 Only allow targeting Stinger Sites when they contain Soldiers.
612+
SpawnBehaviorInterface* spawnInterface = victimObj->getSpawnBehaviorInterface();
613+
if (spawnInterface && spawnInterface->getSlaveCount() == 0)
614+
return 0.0f;
615+
}
616+
#endif
607617
}
608618

609619

0 commit comments

Comments
 (0)