From 290abfdd5810a296c041e39bcf670245b22d0f94 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 22 Jun 2026 18:44:34 +1000 Subject: [PATCH 1/2] bugfix: Sniper weapons can no longer fire upon empty Stinger Sites --- .../Include/GameLogic/Module/SpawnBehavior.h | 2 ++ .../Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h index eb043d35121..4ec859c18a5 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpawnBehavior.h @@ -122,6 +122,7 @@ class SpawnBehaviorInterface virtual Bool areAllSlavesStealthed() const = 0; virtual void revealSlaves() = 0; virtual Bool doSlavesHaveFreedom() const = 0; + virtual Int getSlaveCount() const = 0; }; // ------------------------------------------------------------------------------------------------ @@ -177,6 +178,7 @@ class SpawnBehavior : public UpdateModule, virtual Bool areAllSlavesStealthed() const override; virtual void revealSlaves() override; virtual Bool doSlavesHaveFreedom() const override { return getSpawnBehaviorModuleData()->m_slavesHaveFreeWill; } + virtual Int getSlaveCount() const override { return m_spawnCount; } // ********************************************************************************************** // our own methods diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index deef23cd706..0dabc595a03 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -74,6 +74,7 @@ #include "GameLogic/Module/AssistedTargetingUpdate.h" #include "GameLogic/Module/ProjectileStreamUpdate.h" #include "GameLogic/Module/PhysicsUpdate.h" +#include "GameLogic/Module/SpawnBehavior.h" #include "GameLogic/TerrainLogic.h" #define RATIONALIZE_ATTACK_RANGE @@ -604,6 +605,15 @@ Real WeaponTemplate::estimateWeaponTemplateDamage( if ( victimObj->getContain()->getContainCount() == 0 ) return 0.0f; } +#if !RETAIL_COMPATIBLE_CRC + else + { + // TheSuperHackers @bugfix Stubbjax 22/06/2026 Only allow targeting Stinger Sites when they contain Soldiers. + SpawnBehaviorInterface* spawnInterface = victimObj->getSpawnBehaviorInterface(); + if (spawnInterface && spawnInterface->getSlaveCount() == 0) + return 0.0f; + } +#endif } From 84a4ef9caffae36808939503a2bd5a6d421ead7c Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Tue, 23 Jun 2026 03:09:34 +1000 Subject: [PATCH 2/2] tweak: Cover unspawned states --- GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 0dabc595a03..86ed3664156 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -610,7 +610,7 @@ Real WeaponTemplate::estimateWeaponTemplateDamage( { // TheSuperHackers @bugfix Stubbjax 22/06/2026 Only allow targeting Stinger Sites when they contain Soldiers. SpawnBehaviorInterface* spawnInterface = victimObj->getSpawnBehaviorInterface(); - if (spawnInterface && spawnInterface->getSlaveCount() == 0) + if (spawnInterface && spawnInterface->getSlaveCount() <= 0) return 0.0f; } #endif