Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

feat(gameengine): no superweapons keeps the nuke silo, missile silenced

Olcay Seyganbea86d6a7a0f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ffb47539..708c5586c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -901,6 +901,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
- Superweapons are a dropdown instead of a tick box. Allow Superweapons is the game as it plays without a rule. Limit Superweapons leaves each player one Particle Cannon, one Nuclear Missile or one Scud Storm at a time. No Superweapons bars them.
- No Superweapons can be picked. The dropdown sits low on the settings page, and its last row hung past the bottom edge of the panel: it drew, but a click on it went to nobody and the list stayed on whatever it said before. Any dropdown row past the edge of its panel takes the click now.
- The USA Superweapon General is the exception to both, because the rule that reads as a handicap to everyone else reads as a deletion to him: three superweapons of his own are what he pays for weaker tanks, weaker infantry and a worse air force with. Under Limit he keeps four of each of his. Under No he keeps one. Play him against a lobby that has banned superweapons and you are playing the army you paid for, not an empty base.
+- No Superweapons leaves China its upgrades. The Nuclear Missile silo is where China buys Uranium Shells, Nuclear Tanks and Neutron Shells, so banning it took them off every China general. Each player may now put up one silo under No, the Superweapon General too, and its missile never launches. Nothing treats it as a superweapon either: no fire button, no shortcut, no countdown on anybody's screen, no announcer telling the enemy one is up, and the doors stay shut. The Particle Cannon and the Scud Storm are still banned. A replay of a No Superweapons match recorded before this, where a silo went up or a missile flew, will not play back the same.
- The tick box was one number for everybody, which is why it could only ever say yes or no. A ticked box in a settings file from an older build reads back as No Superweapons.
## Pro Rules, in every network game
@@ -908,13 +909,13 @@ A third pass went through the generals' powers, promotions and unit abilities.
- A fixed list of units, upgrades and tricks is out of every LAN and online match. There is no warning and no penalty after the fact: the button is grey and it stays grey. A skirmish against the computer has the whole arsenal, and so do the campaign and the Generals Challenge.
- It is one box on the network lobby's settings page, Pro Rules, ticked unless the host clears it. The skirmish lobby has no such box. The host's choice goes to everyone in the room and into the replay, and the lobby remembers it for next time. A host on an older build has no box to send, so that game plays without the list.
- No Particle Cannon and no SCUD Storm. The USA Superweapon General keeps one Particle Cannon, because a general who paid for his superweapons with a weaker army and then may not build any is playing half a faction.
-- The Nuclear Missile silo still goes up, since it is where China buys Nuclear Tanks and Uranium Shells. The missile inside it never launches, and nobody's screen counts down to it.
+- The Nuclear Missile silo still goes up, since it is where China buys Nuclear Tanks and Uranium Shells. The missile inside it never launches, it has no fire button, and nobody's screen counts down to it.
- No Aurora Bomber, the Air Force General's Alpha Aurora included, and no Tactical Nuke upgrade for the Nuke General's MiGs.
- No demo bike. A terrorist cannot climb onto a Combat Cycle any more; a rebel, a worker, a hijacker or Jarmen Kell still can.
- A Microwave Tank cannot freeze a building that is still going up. There is nothing for it to fire at until the scaffold is finished, so parking one beside a half-built base no longer keeps it half built.
- No foundation goes down closer to an enemy building than 300, a margin past the 225 a Patriot battery or a Stinger Site reaches on the ground. That ends walling somebody's base in with scaffolds nobody means to finish, and it ends building a tower in their yard too. The placement ghost says why it is red.
- The computer opponent is held to the same list, because it asks the same question your build buttons ask before it spends a dollar.
-- With these rules on, the superweapon dropdown above decides one thing: how many Nuclear Missile silos a player may have standing.
+- With these rules on, the superweapon dropdown above decides one thing: how many Nuclear Missile silos a player may have standing. No Superweapons means one.
- No suicide bomb upgrade for the Demolition General, no Neutron Shells and no Stealth Comanche. The Carpet Bomb stays grey until its owner reaches three stars, which holds back the Air Force General, who can buy his at one.
- Two towers per oil derrick. Your Patriot batteries, Gattling Cannons and Stinger Sites near a derrick count against it, and derricks standing together on the map share one allowance, so the pair 250 apart on Tournament Plains is one derrick for this. The third tower's placement ghost goes red and says why. Your ally's towers do not use up your two, and tunnels are not limited.
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index 236395c1c..7d9766c2f 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -444,6 +444,7 @@ public:
Int m_incomeSharing; ///< -incomesharing <n>: the lobby's income sharing, an IncomeSharing, for an -autoskirmish run
Int m_techRespawn; ///< -techrespawn <n>: the lobby's tech building respawn, in minutes, for an -autoskirmish run
Int m_supplyPileLimit; ///< -supplypilelimit <n>: the lobby's supply pile limit, in players a pile, for an -autoskirmish run
+ Int m_superweapons; ///< -superweapons <n>: the lobby's superweapon rule, a SUPERWEAPONS_ mode, for an -autoskirmish run
Int m_maxGameFrames; ///< -maxframes <n>: quit after n logic frames however the match is going (0 = no limit)
Int m_screenShotFrame; ///< -screenshot <n>: save one picture when the run reaches logic frame n (0 = never)
Int m_videoStartFrame; ///< -video <from> <to> [name]: the first logic frame recorded
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.h
index 11a7b4d22..2b65e5938 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h
@@ -137,10 +137,12 @@ static const char *ScienceAvailabilityNames[] =
// SUPERWEAPONS_ constants in GameNetwork/GUIUtil.h - and this says what it leaves one player: no cap
// at all, no superweapon at all, or a number of each type he may have standing. It takes the
// player template's name because the rule has one exception, the USA Superweapon General, and
-// because a name is what a test can hand it.
+// because a name is what a test can hand it. buildingName is the superweapon's own template: the
+// nuclear silo is the one No leaves standing, one per player, for the upgrades it sells.
//
enum { SUPERWEAPON_CAP_BANNED = -1, SUPERWEAPON_CAP_UNLIMITED = 0 };
-Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName );
+Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName,
+ const AsciiString &buildingName = AsciiString::TheEmptyString );
// The lobby's unit limit is this many units for the whole match, shared out evenly between the
// players who are not watching. UnitLimitPerPlayer is one player's share.
@@ -171,9 +173,16 @@ enum { PRO_RULES_CARPET_BOMB_RANK = 3 };
Bool ProRulesBanUpgrade( const AsciiString &upgradeName );
// rules 2 and 15, for a player of this rank
Bool ProRulesBanSpecialPower( SpecialPowerType specialPowerType, Int rankLevel );
-// the one above asked about the match being played, and about the player's own rank
+// the one above asked about the match being played, and about the player's own rank; it also
+// refuses a missile SuperweaponMissileSilencedInMatch silences
Bool ProRulesRefuseSpecialPower( const Player *player, SpecialPowerType specialPowerType );
+// The silo's missile under Pro Rules or under the lobby's No Superweapons: the silo stands for its
+// upgrades and the missile never fires, so nothing shows it as a superweapon - no countdown, no EVA,
+// no fire button, no shortcut. Both read game setup only, the same on every machine.
+Bool SuperweaponMissileSilenced( SpecialPowerType specialPowerType, Bool proRules, Int superweaponRestriction );
+Bool SuperweaponMissileSilencedInMatch( SpecialPowerType specialPowerType );
+
// Rule 9: no foundation this close to an enemy building, edge to edge. The same 300 world units
// the derrick cluster rules measure with, which is also more than a Patriot or a Stinger Site
// reaches on the ground, so a scaffold wall cannot be laid under an enemy's own defences.
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index b6f45a972..96849a6f9 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -2018,6 +2018,18 @@ Int parseIncomeSharing(char *args[], int num)
return 1;
}
+/* -superweapons <n>: the lobby's superweapon rule for an -autoskirmish run, 1 Limit and 2 No,
+ carried the same way as -incomesharing. */
+Int parseSuperweapons(char *args[], int num)
+{
+ if (TheWritableGlobalData && num > 1 && args[1])
+ {
+ TheWritableGlobalData->m_superweapons = atoi(args[1]);
+ return 2;
+ }
+ return 1;
+}
+
/* -techrespawn <minutes>: the lobby's tech building respawn for an -autoskirmish run, carried the
same way as -incomesharing. */
Int parseTechRespawn(char *args[], int num)
@@ -2469,6 +2481,7 @@ static CommandLineParam params[] =
{ "-unitlimit", parseUnitLimit },
{ "-incomesharing", parseIncomeSharing },
{ "-techrespawn", parseTechRespawn },
+ { "-superweapons", parseSuperweapons },
{ "-supplypilelimit", parseSupplyPileLimit },
{ "-showlanes", parseShowLanes },
{ "-uidrill", parseUIDrill },
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index 0296dc87d..23bc914a1 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -697,6 +697,7 @@ static void startAutoSkirmish( Int numPlayersWanted )
TheSkirmishGameInfo->setIncomeSharing( TheGlobalData->m_incomeSharing );
TheSkirmishGameInfo->setTechRespawn( TheGlobalData->m_techRespawn );
TheSkirmishGameInfo->setSupplyPileLimit( TheGlobalData->m_supplyPileLimit );
+ TheSkirmishGameInfo->setSuperweaponRestriction( (UnsignedShort)TheGlobalData->m_superweapons );
/* -seed makes the whole run repeatable: the seed drives the factions, the colours, the start
positions and every logic random draw after them, so the same command line replays the same
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 10e49c333..250ad4551 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -711,6 +711,7 @@ GlobalData::GlobalData()
m_incomeSharing = 0; // INCOME_SHARING_OFF unless -incomesharing asks
m_techRespawn = 0; // a destroyed tech building stays destroyed unless -techrespawn asks
m_supplyPileLimit = 0; // a supply pile takes any number of players unless -supplypilelimit asks
+ m_superweapons = 0; // SUPERWEAPONS_ALLOW unless -superweapons asks
m_autoSkirmishObserver = FALSE;
m_headless = FALSE;
m_turbo = FALSE;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
index 8b60414ba..33eb4982a 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
@@ -1355,14 +1355,16 @@ static void doFindSpecialPowerSourceObject( Object *obj, void *userData )
//We just care about find an object that has *any* shortcut capable special power.
//Iterate through the special power modules and look for one.
SpecialPowerModuleInterface *spmInterface = obj->findAnyShortcutSpecialPowerModuleInterface();
- if( spmInterface && !spmInterface->isScriptOnly() )
+ if( spmInterface && !spmInterface->isScriptOnly()
+ && !SuperweaponMissileSilencedInMatch( spmInterface->getSpecialPowerTemplate()->getSpecialPowerType() ) )
{
info->obj = obj;
info->lowestReadyFrame = 0;
return;
}
}
- else if( obj->hasSpecialPower( info->spType ) )
+ // a missile that can never fire gets no shortcut button and no hotkey
+ else if( obj->hasSpecialPower( info->spType ) && !SuperweaponMissileSilencedInMatch( info->spType ) )
{
SpecialPowerModuleInterface *spmInterface = obj->findSpecialPowerModuleInterface( info->spType );
if( spmInterface && !spmInterface->isScriptOnly() )
@@ -1412,7 +1414,7 @@ static void doCountSpecialPowersReady( Object *obj, void *userData )
&& !obj->testStatus( OBJECT_STATUS_SOLD )
&& !obj->isEffectivelyDead() )
{
- if( obj->hasSpecialPower( info->spType ) )
+ if( obj->hasSpecialPower( info->spType ) && !SuperweaponMissileSilencedInMatch( info->spType ) )
{
SpecialPowerModuleInterface *spmInterface = obj->findSpecialPowerModuleInterface( info->spType );
if( spmInterface && !spmInterface->isScriptOnly() )
@@ -1804,9 +1806,11 @@ void Player::onStructureConstructionComplete( Object *builder, Object *structure
}
}
- if( structure->hasSpecialPower( SPECIAL_NEUTRON_MISSILE ) ||
- structure->hasSpecialPower( NUKE_SPECIAL_NEUTRON_MISSILE ) ||
+ // a silo whose missile can never fire is announced as nothing more than a building
+ if( ( structure->hasSpecialPower( SPECIAL_NEUTRON_MISSILE ) ||
+ structure->hasSpecialPower( NUKE_SPECIAL_NEUTRON_MISSILE ) ||
structure->hasSpecialPower( SUPW_SPECIAL_NEUTRON_MISSILE ) )
+ && !SuperweaponMissileSilencedInMatch( SPECIAL_NEUTRON_MISSILE ) )
{
if ( localPlayer == structure->getControllingPlayer() )
{
@@ -3044,7 +3048,7 @@ static void countExisting( Object *obj, void *userData )
game unrestricted rather than guessing at a number. */
static const char theSuperweaponGeneralTemplate[] = "FactionAmericaSuperWeaponGeneral";
-Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName )
+Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName, const AsciiString &buildingName )
{
const Bool isSuperweaponGeneral =
playerTemplateName.compareNoCase( theSuperweaponGeneralTemplate ) == 0;
@@ -3052,6 +3056,11 @@ Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName
if ( restriction == SUPERWEAPONS_LIMIT )
return isSuperweaponGeneral ? SUPERWEAPONS_LIMIT_GENERAL : SUPERWEAPONS_LIMIT_OTHERS;
+ // the silo sells China's Uranium Shells, Nuclear Tanks and Neutron Shells, so under No every
+ // player still stands one and only its missile is refused (SuperweaponMissileSilenced)
+ if ( restriction == SUPERWEAPONS_NONE && ProRulesExemptSuperweapon( buildingName ) )
+ return SUPERWEAPONS_LIMIT_OTHERS;
+
if ( restriction == SUPERWEAPONS_NONE )
return isSuperweaponGeneral ? SUPERWEAPONS_NONE_GENERAL : SUPERWEAPON_CAP_BANNED;
@@ -3110,11 +3119,16 @@ Bool ProRulesBanUpgrade( const AsciiString &upgradeName )
// Rule 2, the silo's missile, which each China general and the Superweapon General fire as a type of
// their own, and rule 15, the Carpet Bomb below rank 3. The Air Force General buys his at rank 1 and
// the early China copies come at rank 3, so in practice rule 15 is his.
+static Bool isNeutronMissile( SpecialPowerType specialPowerType )
+{
+ return specialPowerType == SPECIAL_NEUTRON_MISSILE
+ || specialPowerType == NUKE_SPECIAL_NEUTRON_MISSILE
+ || specialPowerType == SUPW_SPECIAL_NEUTRON_MISSILE;
+}
+
Bool ProRulesBanSpecialPower( SpecialPowerType specialPowerType, Int rankLevel )
{
- if ( specialPowerType == SPECIAL_NEUTRON_MISSILE
- || specialPowerType == NUKE_SPECIAL_NEUTRON_MISSILE
- || specialPowerType == SUPW_SPECIAL_NEUTRON_MISSILE )
+ if ( isNeutronMissile( specialPowerType ) )
return TRUE;
const Bool carpetBomb = specialPowerType == SPECIAL_CARPET_BOMB
@@ -3124,9 +3138,22 @@ Bool ProRulesBanSpecialPower( SpecialPowerType specialPowerType, Int rankLevel )
return carpetBomb && rankLevel < PRO_RULES_CARPET_BOMB_RANK;
}
+Bool SuperweaponMissileSilenced( SpecialPowerType specialPowerType, Bool proRules, Int superweaponRestriction )
+{
+ return isNeutronMissile( specialPowerType )
+ && ( proRules || superweaponRestriction == SUPERWEAPONS_NONE );
+}
+
+Bool SuperweaponMissileSilencedInMatch( SpecialPowerType specialPowerType )
+{
+ return SuperweaponMissileSilenced( specialPowerType, TheGameLogic->isProRules(),
+ TheGameLogic->getSuperweaponRestriction() );
+}
+
Bool ProRulesRefuseSpecialPower( const Player *player, SpecialPowerType specialPowerType )
{
- return TheGameLogic->isProRules() && ProRulesBanSpecialPower( specialPowerType, player->getRankLevel() );
+ return SuperweaponMissileSilencedInMatch( specialPowerType )
+ || ( TheGameLogic->isProRules() && ProRulesBanSpecialPower( specialPowerType, player->getRankLevel() ) );
}
// rule 16
@@ -3354,7 +3381,7 @@ Bool Player::canBuildMoreOfType( const ThingTemplate *whatToBuild, Int unitsPerO
restriction = SUPERWEAPONS_NONE;
const AsciiString templateName =
getPlayerTemplate() ? getPlayerTemplate()->getName() : AsciiString::TheEmptyString;
- const Int cap = SuperweaponBuildCap( restriction, templateName );
+ const Int cap = SuperweaponBuildCap( restriction, templateName, whatToBuild->getName() );
if ( cap == SUPERWEAPON_CAP_BANNED )
return false;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp
index f22baa17d..9b24ac83e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp
@@ -1139,7 +1139,8 @@ static void chromaVisitObject( Object *obj, void *userData )
for( BehaviorModule **module = obj->getBehaviorModules(); module && *module; ++module )
{
SpecialPowerModuleInterface *power = (*module)->getSpecialPower();
- if( power == NULL || power->isScriptOnly() )
+ if( power == NULL || power->isScriptOnly()
+ || SuperweaponMissileSilencedInMatch( power->getSpecialPowerTemplate()->getSpecialPowerType() ) )
continue;
const Real charge = power->getPercentReady();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
index 0d09a6b6f..fe997ff27 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
@@ -1612,7 +1612,12 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
// this chain and report the button as available - a power the object cannot even
// perform was drawn ready to fire. There is nothing behind it, so hide it.
return COMMAND_HIDDEN;
- }
+ }
+
+ // a silo whose missile can never fire has no fire button at all
+ if( SuperweaponMissileSilencedInMatch( command->getSpecialPowerTemplate()->getSpecialPowerType() ) )
+ return COMMAND_HIDDEN;
+
//
// the cooldown in seconds: what is left of it while the power charges, and the whole
// of it while the power is ready, so you can see what firing it will cost you
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index d480bfd4f..b3acc2bc5 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -752,7 +752,7 @@ void InGameUI::addSuperweapon(Int playerIndex, const AsciiString& powerName, Obj
if (powerTemplate == NULL)
return;
- // Pro Rules: a silo nobody may fire gets no countdown on everybody's screen and no "missile ready"
+ // Pro Rules or No Superweapons: a silo nobody may fire gets no countdown on everybody's screen and no "missile ready"
if (ProRulesRefuseSpecialPower(ThePlayerList->getNthPlayer(playerIndex), powerTemplate->getSpecialPowerType()))
return;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
index 93ff74d34..eb9430085 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp
@@ -63,8 +63,8 @@
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
-/** Rules 2 and 15 of Pro Rules: the silo stands and charges and firing it is refused, and so is a
- * Carpet Bomb below rank 3. Every route to firing - the button, a hotkey, a script, a computer
+/** Rules 2 and 15 of Pro Rules, and the lobby's No Superweapons: the silo stands and charges and
+ * firing it is refused, and so is a Pro Rules Carpet Bomb below rank 3. Every route to firing - the button, a hotkey, a script, a computer
* player - ends in one of the four do calls. */
static Bool proRulesRefuse( const Object *object, const SpecialPowerTemplate *specialPowerTemplate )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp
index 3cfcc583c..070576861 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp
@@ -247,7 +247,8 @@ UpdateSleepTime MissileLauncherBuildingUpdate::update( void )
DEBUG_ASSERTCRASH(m_specialPowerModule, ("Missing special power"));
}
- if (m_specialPowerModule)
+ // a missile that can never fire is never shown ready: the doors stay shut
+ if (m_specialPowerModule && !SuperweaponMissileSilencedInMatch(m_specialPowerModule->getSpecialPowerTemplate()->getSpecialPowerType()))
{
UnsignedInt readyFrame = m_specialPowerModule->getReadyFrame();
UnsignedInt whenToStartOpening = (readyFrame >= d->m_doorOpenTime) ? (readyFrame - d->m_doorOpenTime) : 0;
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 597556db3..22a9d3c87 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -13923,6 +13923,26 @@ TEST(the_superweapon_rule_is_a_mode_with_one_exception)
CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, laserGeneral ), (Int)SUPERWEAPON_CAP_BANNED );
CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, superweaponGeneral ), 1 );
+ // except the silo, one for everybody, built for China's upgrades: its missile is what No refuses
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, gla, AsciiString( "ChinaNuclearMissileLauncher" ) ), 1 );
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, gla, AsciiString( "Nuke_ChinaNuclearMissileLauncher" ) ), 1 );
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, superweaponGeneral, AsciiString( "SupW_AmericaNuclearMissileLauncher" ) ), 1 );
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, gla, AsciiString( "GLAScudStorm" ) ), (Int)SUPERWEAPON_CAP_BANNED );
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, laserGeneral, AsciiString( "Lazr_AmericaParticleCannonUplink" ) ), (Int)SUPERWEAPON_CAP_BANNED );
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_LIMIT, superweaponGeneral, AsciiString( "SupW_AmericaNuclearMissileLauncher" ) ), 4 );
+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_ALLOW, gla, AsciiString( "ChinaNuclearMissileLauncher" ) ), (Int)SUPERWEAPON_CAP_UNLIMITED );
+
+ // and that missile is silenced under No or Pro Rules, every general's copy, and nothing else is
+ CHECK( SuperweaponMissileSilenced( SPECIAL_NEUTRON_MISSILE, FALSE, SUPERWEAPONS_NONE ) );
+ CHECK( SuperweaponMissileSilenced( NUKE_SPECIAL_NEUTRON_MISSILE, FALSE, SUPERWEAPONS_NONE ) );
+ CHECK( SuperweaponMissileSilenced( SUPW_SPECIAL_NEUTRON_MISSILE, FALSE, SUPERWEAPONS_NONE ) );
+ CHECK( SuperweaponMissileSilenced( SPECIAL_NEUTRON_MISSILE, TRUE, SUPERWEAPONS_ALLOW ) );
+ CHECK( !SuperweaponMissileSilenced( SPECIAL_NEUTRON_MISSILE, FALSE, SUPERWEAPONS_LIMIT ) );
+ CHECK( !SuperweaponMissileSilenced( SPECIAL_NEUTRON_MISSILE, FALSE, SUPERWEAPONS_ALLOW ) );
+ CHECK( !SuperweaponMissileSilenced( SPECIAL_PARTICLE_UPLINK_CANNON, TRUE, SUPERWEAPONS_NONE ) );
+ CHECK( !SuperweaponMissileSilenced( SPECIAL_SCUD_STORM, TRUE, SUPERWEAPONS_NONE ) );
+ CHECK( !SuperweaponMissileSilenced( SPECIAL_CLUSTER_MINES, FALSE, SUPERWEAPONS_NONE ) );
+
// a player with no template at all - the civilian seat - is nobody's exception
CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, AsciiString::TheEmptyString ), (Int)SUPERWEAPON_CAP_BANNED );