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.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): no superweapons silo is an upgrade building for everyone
Olcay Seygandbb4b635f233
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ac8a56160..32e934dc1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -635,7 +635,7 @@ found and fixed, EA's own, not port damage.**- The computer picked its superweapon target by adding up what your things cost inside the blast, so a supply stash outranked the tank column parked next to it. Anything that can shoot back is now worth several times its price, and base defences and massed armour are what the shot goes looking for.- It could only aim inside the rectangle your buildings sit in. An attack wave sitting on its doorstep was never a target at all; now your army counts wherever it is standing.-- Under No Superweapons the computer no longer builds the Nuclear Missile silo. A player still can, because China's upgrades are sold there, and its missile never fires.+- Under No Superweapons the Nuclear Missile silo is a shop for China's Uranium Shells, Nuclear Tanks and Neutron Shells and nothing else, for you and for the computer alike. It has no missile at all: no launch button, no countdown on anybody's screen, no announcer, and the doors never open. The computer builds one again, but only when one of those upgrades is worth buying for the tanks it owns, and then buys it; it used to rush the silo up as its superweapon. Four China computers on Twilight Flame asked for theirs at about two and a half minutes and had them standing at four and a half to five and a half; now the Hard ones ask at five and a half to six minutes, the silo stands at eight and a half, and Medium puts its own up around nine and a half for Nuclear Tanks. Every other superweapon stays barred for every side, the Kargu Base too, and the USA Superweapon General keeps exactly one.- Two silos ready on the same second fired at the same spot, because nothing that was already in the air was on the map yet. A spot that has just been aimed at is worth nothing to the next shot and climbs back over ten minutes, so the salvo spreads across your base instead of digging one crater.- Measured over a half-hour match: a Particle Cannon that fired at the identical spot three times running now spreads six shots over five parts of the map, and comes back to the first one at the end, when what you rebuilt there is worth twice what it killed.- The spy satellite goes through the same targeting, and it was scanning one cell of one base seventeen times a match. It sweeps now.diff --git a/GeneralsMD/Code/Data/French/Generals.str b/GeneralsMD/Code/Data/French/Generals.strindex 7eb3ac6b0..464241c48 100644--- a/GeneralsMD/Code/Data/French/Generals.str+++ b/GeneralsMD/Code/Data/French/Generals.str@@ -16562,7 +16562,7 @@ GUI:SuperweaponsNoneENDTOOLTIP:Superweapons-"Combien de chaque superarme un joueur peut avoir debout. Autoriser : autant qu'il peut en payer. Limiter : une de chaque, et quatre pour le Général superarme USA. Pas de superarmes : aucune, sauf pour le Général superarme, qui en garde une. Il fait exception parce que ses trois superarmes sont ce qu'il obtient en échange d'une armée plus faible."+"Combien de superarmes un joueur peut avoir debout. Autoriser : autant qu'il peut en payer. Limiter : une, et quatre pour le Général superarme USA. Pas de superarmes : aucune, sauf pour le Général superarme, qui en garde une. Il fait exception parce que ses superarmes sont ce qu'il obtient en échange d'une armée plus faible. Sans superarmes, chacun, l'ordinateur aussi, peut encore bâtir un silo de missile nucléaire pour y acheter les améliorations de la Chine. Il n'a pas de missile, ni bouton de tir, ni compte à rebours, ni annonce."ENDGUI:UnitLimitdiff --git a/GeneralsMD/Code/Data/German/Generals.str b/GeneralsMD/Code/Data/German/Generals.strindex fdedbbc27..f609da8dc 100644--- a/GeneralsMD/Code/Data/German/Generals.str+++ b/GeneralsMD/Code/Data/German/Generals.str@@ -2762,7 +2762,7 @@ TOOLTIP:CratesENDTOOLTIP:SuperWeapons-"Wie viele Superwaffen jeder Art ein Spieler gleichzeitig haben darf. Erlaubt: so viele, wie er bezahlen kann. Limit: je eine, vier für den USA-Superwaffengeneral. Nein: keine, außer beim Superwaffengeneral, der eine behält. Er ist die Ausnahme, weil er mit seinen drei Superwaffen eine schwächere Armee ausgleicht."+"Wie viele Superwaffen ein Spieler gleichzeitig haben darf. Erlaubt: so viele, wie er bezahlen kann. Limit: eine, vier für den USA-Superwaffengeneral. Nein: keine, außer beim Superwaffengeneral, der eine behält. Er ist die Ausnahme, weil er mit seinen Superwaffen eine schwächere Armee ausgleicht. Unter Nein darf jeder, auch der Computer, noch ein Atomraketensilo bauen, um darin Chinas Upgrades zu kaufen. Es hat keine Rakete: keinen Startknopf, keinen Countdown, keine Ansage."ENDDOZER:ConstructionCompletediff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex b9887026c..758e0444c 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -1335,7 +1335,7 @@ GUI:SuperweaponsNoneENDTOOLTIP:Superweapons-"How many of each superweapon a player may have standing. Allow: as many as he can pay for. Limit: one each, and four for the USA Superweapon General. No: none at all, except the Superweapon General, who keeps one. He is the exception because his three superweapons are what he pays for a weaker army with. Under No a player may still put up one Nuclear Missile silo for China's upgrades, but it never fires, and computer players build none."+"How many superweapons a player may have standing. Allow: as many as he can pay for. Limit: one, and four for the USA Superweapon General. No: none at all, except the Superweapon General, who keeps one. He is the exception because his superweapons are what he pays for a weaker army with. Under No anyone, computer players too, may still put up one Nuclear Missile silo to buy China's upgrades in. It has no missile: no launch button, no countdown, no announcement."ENDGUI:UnitLimitdiff --git a/GeneralsMD/Code/Data/Russian/Generals.str b/GeneralsMD/Code/Data/Russian/Generals.strindex af68b59b5..cd1d3f0a6 100644--- a/GeneralsMD/Code/Data/Russian/Generals.str+++ b/GeneralsMD/Code/Data/Russian/Generals.str@@ -2994,7 +2994,7 @@ TOOLTIP:CratesENDTOOLTIP:SuperWeapons-"Сколько супероружия каждого вида может иметь игрок одновременно. Разрешено: сколько он в состоянии оплатить. Лимит: по одному, а для генерала США по супероружию — четыре. Нет: ни одного, кроме генерала по супероружию, у которого остаётся одно. Он исключение, потому что три его супероружия — плата за более слабую армию."+"Сколько супероружия может иметь игрок одновременно. Разрешено: сколько он в состоянии оплатить. Лимит: одно, а для генерала США по супероружию — четыре. Нет: ни одного, кроме генерала по супероружию, у которого остаётся одно. Он исключение, потому что его супероружие — плата за более слабую армию. При «Нет» любой, и компьютер тоже, может построить одну шахту ядерной ракеты, чтобы покупать в ней улучшения Китая. Ракеты в ней нет: ни кнопки запуска, ни обратного отсчёта, ни объявления."ENDDOZER:ConstructionCompletediff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 50f4b93d0..872c15bf1 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -2878,7 +2878,7 @@ TOOLTIP:CratesENDTOOLTIP:SuperWeapons-"Bir oyuncunun aynı anda ayakta tutabileceği süper silah sayısı. İzin Ver: parası yettiği kadar. Sınırla: her birinden bir tane, ABD Süper Silah Generali için dört. Yok: hiç yok, yalnızca Süper Silah Generali bir tane tutar. İstisna odur, çünkü zayıf ordusunun bedelini bu üç süper silahla öder. Yok seçiliyken bir oyuncu Çin'in geliştirmeleri için yine de bir Nükleer Füze silosu kurabilir ama silo asla ateşlemez; bilgisayar oyuncuları hiç kurmaz."+"Bir oyuncunun aynı anda kaç süper silahı olabilir. İzin Ver: parası neye yetiyorsa. Sınırla: bir tane, ABD Süper Silah Generali'ne dört. Yok: hiç yok, bir tek Süper Silah Generali bir tane tutar. Onun istisna olması şundan: zayıf ordusunun bedelini süper silahlarıyla ödüyor. Yok seçiliyse herkes, bilgisayar da, Çin'in geliştirmelerini almak için bir Nükleer Füze silosu kurabilir. Siloda füze yok: ateşleme düğmesi yok, geri sayım yok, anons yok."ENDDOZER:ConstructionCompletediff --git a/GeneralsMD/Code/Data/Ukrainian/Generals.str b/GeneralsMD/Code/Data/Ukrainian/Generals.strindex 2777a1d85..aacb0bdb5 100644--- a/GeneralsMD/Code/Data/Ukrainian/Generals.str+++ b/GeneralsMD/Code/Data/Ukrainian/Generals.str@@ -2994,7 +2994,7 @@ TOOLTIP:CratesENDTOOLTIP:SuperWeapons-"Скільки суперзброї кожного виду може мати гравець одночасно. Дозволено: стільки, скільки він може оплатити. Ліміт: по одній, а для генерала суперзброї США чотири. Ні: жодної, окрім генерала суперзброї, який залишає одну. Він виняток, бо його три суперзброї — це те, чим він платить за слабшу армію."+"Скільки суперзброї може мати гравець одночасно. Дозволено: стільки, скільки він може оплатити. Ліміт: одна, а для генерала суперзброї США чотири. Ні: жодної, окрім генерала суперзброї, який залишає одну. Він виняток, бо його суперзброя — це те, чим він платить за слабшу армію. При «Ні» будь-хто, і комп'ютер теж, може збудувати одну шахту ядерної ракети, щоб купувати в ній покращення Китаю. Ракети в ній немає: ні кнопки запуску, ні зворотного відліку, ні оголошення."ENDDOZER:ConstructionCompletediff --git a/GeneralsMD/Code/GameEngine/Include/Common/Player.h b/GeneralsMD/Code/GameEngine/Include/Common/Player.hindex 29e51e60e..fdbec991a 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/Player.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/Player.h@@ -141,14 +141,13 @@ static const char *ScienceAvailabilityNames[] =// 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. buildingName is the superweapon's own template: the-// nuclear silo is the one No leaves standing, one per human player, for the upgrades it sells; a-// computer player builds none, since it put one up as its superweapon. computerPlayer is-// getPlayerType() == PLAYER_COMPUTER, every computer seat on either AI and every difficulty.+// nuclear silo is the one No leaves standing, one per player, human or computer, for the upgrades+// it sells. Every superweapon shares the Superweapon link key, so a cap is on all of a player's+// superweapons together, not on each type.//enum { SUPERWEAPON_CAP_BANNED = -1, SUPERWEAPON_CAP_UNLIMITED = 0 };Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName,- const AsciiString &buildingName = AsciiString::TheEmptyString,- Bool computerPlayer = FALSE );+ 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.@@ -177,6 +176,12 @@ Bool RebuildHoleHoldsSuperweapon( Bool rebuildsSuperweapon, Bool rebuildStanding// getPlayerType() == PLAYER_COMPUTER, which every machine and the replay hold alike.Bool SuperweaponNeedsDefenses( const AsciiString &buildingName, Bool proRules, Int superweaponRestriction,Bool computerPlayer );+// That silo, by name and game setup: a building with upgrades in it and nothing more, for every+// player and every AI. The InMatch one asks the match being played and is the test anything in+// logic or on screen uses for "is this a superweapon": FS_SUPERWEAPON, less that silo.+Bool SuperweaponSiloIsUpgradeBuilding( const AsciiString &buildingName, Bool proRules, Int superweaponRestriction );+class ThingTemplate;+Bool IsSuperweaponInMatch( const ThingTemplate *tmpl );// The lobby's income sharing, an IncomeSharing from GameInfo.h: whether a payment is split in this// match, and each ally's cut when it is split evenly between sharers players. The earner keeps what@@ -225,12 +230,11 @@ Bool ProRulesBanSpecialPower( SpecialPowerType specialPowerType, Int rankLevel )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.+// upgrades and the missile is no special power at all (SpecialPowerModule::getSpecialPower), so it+// is never armed, listed, counted down, announced or fired. Both read game setup only, the same on+// every machine.Bool SuperweaponMissileSilenced( SpecialPowerType specialPowerType, Bool proRules, Int superweaponRestriction );Bool SuperweaponMissileSilencedInMatch( SpecialPowerType specialPowerType );-// the silo of a missile the one above silences: no banner, no feed line, announced as a building-Bool SuperweaponSiloSilencedInMatch( const Object *structure );// 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 Sitediff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.hindex 2a517ccec..71ffe5b82 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialPowerModule.h@@ -110,7 +110,9 @@ public:static Int getInterfaceMask() { return MODULEINTERFACE_SPECIAL_POWER; }// BehaviorModule- virtual SpecialPowerModuleInterface* getSpecialPower() { return this; }+ // NULL for a silo whose missile the match silences (SuperweaponMissileSilencedInMatch, game setup+ // only): nothing finds the power, so nothing arms, lists, counts down, announces or fires it+ virtual SpecialPowerModuleInterface* getSpecialPower();Bool isModuleForPower( const SpecialPowerTemplate *specialPowerTemplate ) const; ///< is this module for the specified special powerBool isReady( void ) const; ///< is this special power available nowdiff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/MatchHistory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/MatchHistory.cppindex 4459c61e9..69fd49dff 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/MatchHistory.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/MatchHistory.cpp@@ -171,7 +171,7 @@ void MatchHistory::noteBuilt( const Player *player, const Object *thing )if( tmpl->isKindOf( KINDOF_DRONE ) || tmpl->isKindOf( KINDOF_PROJECTILE ) || tmpl->isKindOf( KINDOF_MINE ) )return;const UnsignedInt frame = TheGameLogic->getFrame();- if( tmpl->isKindOf( KINDOF_FS_SUPERWEAPON ) )+ if( IsSuperweaponInMatch( tmpl ) )addEvent( frame, index, MATCH_EVENT_SUPERWEAPON_BUILT, tmpl, NULL, 0 );std::vector< MatchBuild > &builds = m_builds[ index ];diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cppindex e17fad965..909246eee 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp@@ -1408,16 +1408,15 @@ 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()- && !SuperweaponMissileSilencedInMatch( spmInterface->getSpecialPowerTemplate()->getSpecialPowerType() ) )+ if( spmInterface && !spmInterface->isScriptOnly() ){info->obj = obj;info->lowestReadyFrame = 0;return;}}- // a missile that can never fire gets no shortcut button and no hotkey- else if( obj->hasSpecialPower( info->spType ) && !SuperweaponMissileSilencedInMatch( info->spType ) )+ // a silenced missile is no special power (SpecialPowerModule::getSpecialPower): no shortcut, no hotkey+ else if( obj->hasSpecialPower( info->spType ) ){SpecialPowerModuleInterface *spmInterface = obj->findSpecialPowerModuleInterface( info->spType );if( spmInterface && !spmInterface->isScriptOnly() )@@ -1467,7 +1466,7 @@ static void doCountSpecialPowersReady( Object *obj, void *userData )&& !obj->testStatus( OBJECT_STATUS_SOLD )&& !obj->isEffectivelyDead() ){- if( obj->hasSpecialPower( info->spType ) && !SuperweaponMissileSilencedInMatch( info->spType ) )+ if( obj->hasSpecialPower( info->spType ) ){SpecialPowerModuleInterface *spmInterface = obj->findSpecialPowerModuleInterface( info->spType );if( spmInterface && !spmInterface->isScriptOnly() )@@ -1882,11 +1881,10 @@ void Player::onStructureConstructionComplete( Object *builder, Object *structure}}- // a silo whose missile can never fire is announced as nothing more than a building- if( ( structure->hasSpecialPower( SPECIAL_NEUTRON_MISSILE ) ||+ // a silo whose missile is silenced has no special power at all, so it is announced as 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() ){@@ -3260,8 +3258,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, const AsciiString &buildingName,- Bool computerPlayer )+Int SuperweaponBuildCap( Int restriction, const AsciiString &playerTemplateName, const AsciiString &buildingName ){const Bool isSuperweaponGeneral =playerTemplateName.compareNoCase( theSuperweaponGeneralTemplate ) == 0;@@ -3269,12 +3266,12 @@ 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 a human- // still stands one and only its missile is refused (SuperweaponMissileSilenced). A computer- // player builds none: it rushed one up as its superweapon, and a player who picked No saw the- // AI build a superweapon. The Superweapon General's own silo goes with it, silenced and useless.+ // the silo sells China's Uranium Shells, Nuclear Tanks and Neutron Shells, so under No every+ // player, the computer too, still stands one, and its missile is no special power at all+ // (SuperweaponMissileSilenced). The computer builds it for those upgrades, never as its+ // superweapon (IsSuperweaponInMatch).if ( restriction == SUPERWEAPONS_NONE && ProRulesExemptSuperweapon( buildingName ) )- return computerPlayer ? SUPERWEAPON_CAP_BANNED : SUPERWEAPONS_LIMIT_OTHERS;+ return SUPERWEAPONS_LIMIT_OTHERS;if ( restriction == SUPERWEAPONS_NONE )return isSuperweaponGeneral ? SUPERWEAPONS_NONE_GENERAL : SUPERWEAPON_CAP_BANNED;@@ -3365,14 +3362,6 @@ Bool SuperweaponMissileSilencedInMatch( SpecialPowerType specialPowerType )TheGameLogic->getSuperweaponRestriction() );}-Bool SuperweaponSiloSilencedInMatch( const Object *structure )-{- return ( structure->hasSpecialPower( SPECIAL_NEUTRON_MISSILE )- || structure->hasSpecialPower( NUKE_SPECIAL_NEUTRON_MISSILE )- || structure->hasSpecialPower( SUPW_SPECIAL_NEUTRON_MISSILE ) )- && SuperweaponMissileSilencedInMatch( SPECIAL_NEUTRON_MISSILE );-}-Bool ProRulesRefuseSpecialPower( const Player *player, SpecialPowerType specialPowerType ){return SuperweaponMissileSilencedInMatch( specialPowerType )@@ -3519,8 +3508,20 @@ Bool DefenseCountsForSuperweapons( Int buildCost )Bool SuperweaponNeedsDefenses( const AsciiString &buildingName, Bool proRules, Int superweaponRestriction,Bool computerPlayer ){- return computerPlayer && !( ProRulesExemptSuperweapon( buildingName )- && SuperweaponMissileSilenced( SPECIAL_NEUTRON_MISSILE, proRules, superweaponRestriction ) );+ return computerPlayer && !SuperweaponSiloIsUpgradeBuilding( buildingName, proRules, superweaponRestriction );+}++Bool SuperweaponSiloIsUpgradeBuilding( const AsciiString &buildingName, Bool proRules, Int superweaponRestriction )+{+ return ProRulesExemptSuperweapon( buildingName )+ && SuperweaponMissileSilenced( SPECIAL_NEUTRON_MISSILE, proRules, superweaponRestriction );+}++Bool IsSuperweaponInMatch( const ThingTemplate *tmpl )+{+ return tmpl->isKindOf( KINDOF_FS_SUPERWEAPON )+ && !SuperweaponSiloIsUpgradeBuilding( tmpl->getName(), TheGameLogic->isProRules(),+ TheGameLogic->getSuperweaponRestriction() );}/* A defence counts once it stands finished, so a foundation put down and cancelled never unlocks@@ -3538,7 +3539,7 @@ static void countSuperweaponDefenses( Object *obj, void *userData )return;SuperweaponDefenseCount *count = (SuperweaponDefenseCount *)userData;- if ( obj->isKindOf( KINDOF_FS_SUPERWEAPON ) )+ if ( IsSuperweaponInMatch( obj->getTemplate() ) )count->superweapons++;else if ( obj->isKindOf( KINDOF_FS_BASE_DEFENSE ) && !obj->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION )&& DefenseCountsForSuperweapons( obj->getTemplate()->friend_getBuildCost() ) )@@ -3742,8 +3743,7 @@ Bool Player::canBuildMoreOfType( const ThingTemplate *whatToBuild, Int unitsPerOrestriction = SUPERWEAPONS_NONE;const AsciiString templateName =getPlayerTemplate() ? getPlayerTemplate()->getName() : AsciiString::TheEmptyString;- const Int cap = SuperweaponBuildCap( restriction, templateName, whatToBuild->getName(),- getPlayerType() == PLAYER_COMPUTER );+ const Int cap = SuperweaponBuildCap( restriction, templateName, whatToBuild->getName() );if ( cap == SUPERWEAPON_CAP_BANNED )return false;diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cppindex 5d8987aaf..5be377280 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp@@ -682,8 +682,10 @@ Module *ModuleFactory::newModule( Thing *thing, const AsciiString& name, const MDEBUG_ASSERTCRASH(((mt->m_whichInterfaces & (MODULEINTERFACE_DIE)) != 0) == (bm->getDie() != NULL),("getInterfaceMask bad for MODULE_DIE (%s)\n",name.str()));+ // a silenced silo's power answers NULL on purpose (SpecialPowerModule::getSpecialPower), so+ // only a module that is no special power must never answer oneDEBUG_ASSERTCRASH(- ((mt->m_whichInterfaces & (MODULEINTERFACE_SPECIAL_POWER)) != 0) == (bm->getSpecialPower() != NULL),+ ((mt->m_whichInterfaces & (MODULEINTERFACE_SPECIAL_POWER)) != 0) || (bm->getSpecialPower() == NULL),("getInterfaceMask bad for MODULE_SPECIAL_POWER (%s)\n",name.str()));DEBUG_ASSERTCRASH(((mt->m_whichInterfaces & (MODULEINTERFACE_UPDATE)) != 0) == (bm->getUpdate() != NULL),diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cppindex 3c1763018..4b8e9fade 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ChromaKeyboard.cpp@@ -1155,8 +1155,7 @@ static void chromaVisitObject( Object *obj, void *userData )for( BehaviorModule **module = obj->getBehaviorModules(); module && *module; ++module ){SpecialPowerModuleInterface *power = (*module)->getSpecialPower();- if( power == NULL || power->isScriptOnly()- || SuperweaponMissileSilencedInMatch( power->getSpecialPowerTemplate()->getSpecialPowerType() ) )+ if( power == NULL || power->isScriptOnly() )continue;const Real charge = power->getPercentReady();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cppindex f1e26da05..485e4b767 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp@@ -5304,9 +5304,7 @@ void Drawable::drawHealthBar(const IRegion2D* healthBarRegion)if( sp == NULL || sp->isReady() )continue;const SpecialPowerTemplate *tmpl = sp->getSpecialPowerTemplate();- // a silo whose missile can never fire charges towards nothing- if( tmpl == NULL || !tmpl->hasPublicTimer()- || SuperweaponMissileSilencedInMatch( tmpl->getSpecialPowerType() ) )+ if( tmpl == NULL || !tmpl->hasPublicTimer() )continue;ScienceType needed = sp->getRequiredScience();diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cppindex aabf5b1a6..02c207b05 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp@@ -1638,6 +1638,11 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com// sanityDEBUG_ASSERTCRASH( command->getSpecialPowerTemplate() != NULL,("The special power in the command '%s' is NULL\n", command->getName().str()) );++ // a silo whose missile is silenced has no such power at all, and no fire button+ if( SuperweaponMissileSilencedInMatch( command->getSpecialPowerTemplate()->getSpecialPowerType() ) )+ return COMMAND_HIDDEN;+// get special power module from the object to execute itSpecialPowerModuleInterface *mod = obj->getSpecialPowerModule( command->getSpecialPowerTemplate() );@@ -1654,10 +1659,6 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *comreturn COMMAND_HIDDEN;}- // a silo whose missile can never fire has no fire button at all- if( SuperweaponMissileSilencedInMatch( command->getSpecialPowerTemplate()->getSpecialPowerType() ) )- return COMMAND_HIDDEN;-// Pro Rules: the power is there and the button stays deadif( ProRulesRefuseSpecialPower( obj->getControllingPlayer(), command->getSpecialPowerTemplate()->getSpecialPowerType() ) )return COMMAND_RESTRICTED;diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cppindex ed2ead25a..f27cb5f41 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/ObserverCamera.cpp@@ -3059,7 +3059,7 @@ void ObserverCamera::scout( void )hit.position.x = obj->getPosition()->x;hit.position.y = obj->getPosition()->y;hit.weight = ObserverCamera_hitWeight( obj->getTemplate()->friend_getBuildCost(), obj->isEffectivelyDead(),- obj->isKindOf( KINDOF_FS_SUPERWEAPON ), obj->isKindOf( KINDOF_INFANTRY ) );+ IsSuperweaponInMatch( obj->getTemplate() ), obj->isKindOf( KINDOF_INFANTRY ) );hits.push_back( hit );}ObserverCamera_markLandings( m_scouted, hits, frame );@@ -3189,7 +3189,7 @@ Bool ObserverCamera::directorPlace( const Player *narrowTo, Coord2D *place )for( Object *obj = TheGameLogic->getFirstObject(); obj != NULL; obj = obj->getNextObject() ){const Int cost = obj->getTemplate()->friend_getBuildCost();- const Bool superweapon = obj->isKindOf( KINDOF_FS_SUPERWEAPON );+ const Bool superweapon = IsSuperweaponInMatch( obj->getTemplate() );const Bool mine = narrowTo == NULL || obj->getControllingPlayer() == narrowTo;DirectorHeat heat;heat.position.x = obj->getPosition()->x;diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cppindex 228384f5b..148e7f8e9 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp@@ -7264,7 +7264,7 @@ static void tallyObject( Object *obj, void *userData )return;if( obj->isKindOf( KINDOF_FS_BASE_DEFENSE ) )++tally->defenses;- else if( obj->isKindOf( KINDOF_FS_SUPERWEAPON ) )+ else if( IsSuperweaponInMatch( obj->getTemplate() ) )++tally->superweapons;else if( !obj->isKindOf( KINDOF_STRUCTURE ) && !obj->isKindOf( KINDOF_DOZER ) && !obj->isKindOf( KINDOF_HARVESTER ) &&!obj->isKindOf( KINDOF_MONEY_HACKER ) && obj->isAbleToAttack() )@@ -8369,6 +8369,9 @@ void AIPlayer::doSuperweapons( void )// with the purchase queue they are asked for before the bank can pay, and the queue saves for themconst ThingTemplate *superweapon = buildableOfKind( dozer, GUI_COMMAND_DOZER_CONSTRUCT, KINDOF_FS_SUPERWEAPON, purchaseQueueOn() );+ // a silo whose missile is silenced goes up for its upgrades, when one is worth it (buyUpgradesForArmy)+ if( superweapon && !IsSuperweaponInMatch( superweapon ) )+ superweapon = NULL;const ThingTemplate *techBuilding = buildableOfKind( dozer, GUI_COMMAND_DOZER_CONSTRUCT, KINDOF_FS_ADVANCED_TECH, purchaseQueueOn() );TechCount tech;@@ -8568,7 +8571,8 @@ AIPurchaseKind AIPlayer::purchaseKindOf( const ThingTemplate *tmpl ) constif( tmpl->isKindOf( KINDOF_HARVESTER ) || tmpl->isKindOf( KINDOF_MONEY_HACKER ) || tmpl->isKindOf( KINDOF_FS_SUPPLY_CENTER ) ||tmpl->isKindOf( KINDOF_FS_SUPPLY_DROPZONE ) || tmpl->isKindOf( KINDOF_FS_BLACK_MARKET ) || tmpl->isKindOf( KINDOF_FS_INTERNET_CENTER ) )return AIBUY_ECONOMY;- if( tmpl->isKindOf( KINDOF_FS_SUPERWEAPON ) || tmpl->isKindOf( KINDOF_FS_ADVANCED_TECH ) )+ // a silo whose missile is silenced is bought as a building, for its upgrades+ if( IsSuperweaponInMatch( tmpl ) || tmpl->isKindOf( KINDOF_FS_ADVANCED_TECH ) )return AIBUY_SUPERWEAPON;if( tmpl->isKindOf( KINDOF_FS_BASE_DEFENSE ) )return AIBUY_DEFENSE;@@ -10232,6 +10236,40 @@ void AIPlayer::buyUpgradesForArmy( Bool overTarget )where[ u ] = *f;}}++ // A silo whose missile is silenced is only where China buys Uranium Shells, Nuclear Tanks and+ // Neutron Shells, so it goes up when one of them is worth buying: while none stands or is asked+ // for, its upgrades are weighed with the rest at the silo's price on top, with no building to+ // buy them at (where NULL), and a pick of one asks for the silo instead.+ const ThingTemplate *silo = NULL;+ Int siloCost = 0;+ Object *dozer = NULL;+ m_player->iterateObjects( findAnyDozer, &dozer );+ if( dozer )+ silo = buildableOfKind( dozer, GUI_COMMAND_DOZER_CONSTRUCT, KINDOF_FS_SUPERWEAPON, TRUE );+ if( silo && ( IsSuperweaponInMatch( silo ) || priorityBuildPending( m_player, silo ) ) )+ silo = NULL;+ const CommandSet *siloSet = silo ? TheCommandStore->findCommandSet( silo->friend_getCommandSetString() ) : NULL;+ for( Int i = 0; siloSet && i < MAX_COMMANDS_PER_SET; ++i )+ {+ const CommandButton *button = siloSet->getCommandButton( i );+ if( button == NULL || button->getCommandType() != GUI_COMMAND_PLAYER_UPGRADE || button->getUpgradeTemplate() == NULL )+ continue;+ const UpgradeTemplate *upgrade = button->getUpgradeTemplate();+ if( m_player->hasUpgradeComplete( upgrade ) || m_player->hasUpgradeInProduction( upgrade ) ||+ std::find( upgrades.begin(), upgrades.end(), upgrade ) != upgrades.end() ||+ ( TheGameLogic->isProRules() && ProRulesBanUpgrade( upgrade->getUpgradeName() ) ) )+ continue;+ Bool sciences = TRUE;+ for( size_t s = 0; s < button->getScienceVec().size(); ++s )+ if( !m_player->hasScience( button->getScienceVec()[ s ] ) )+ sciences = FALSE;+ if( !sciences )+ continue;+ upgrades.push_back( upgrade );+ where.push_back( NULL );+ siloCost = silo->calcCostToBuild( m_player );+ }if( upgrades.empty() )return;@@ -10282,10 +10320,18 @@ void AIPlayer::buyUpgradesForArmy( Bool overTarget )std::vector<Int> cost( upgrades.size(), 0 );for( size_t u = 0; u < upgrades.size(); ++u )- cost[ u ] = upgrades[ u ]->calcCostToBuild( m_player );+ cost[ u ] = upgrades[ u ]->calcCostToBuild( m_player ) + ( where[ u ] == NULL ? siloCost : 0 );const Int pick = aiPickUpgrade( &covered[ 0 ], &cost[ 0 ], (Int)upgrades.size(), profile->m_upgradePayoff, overTarget );if( pick < 0 )return;+ if( where[ pick ] == NULL )+ {+ DEBUG_LOG(("AI UPGRADE frame %d player %d asks for '%s' to buy '%s' at %d, improves %.0f of what it owns, %d in the bank\n",+ now, m_player->getPlayerIndex(), silo->getName().str(), upgrades[ pick ]->getUpgradeName().str(),+ cost[ pick ], covered[ pick ], m_player->getMoney()->countMoney()));+ buildAsap( silo );+ return;+ }const Int offset = 2.0f * likedCovered[ pick ] > covered[ pick ] ? PERSONA_KIND_UPGRADE_SCORE : 0;if( buyUpgrade( where[ pick ]->getProductionUpdateInterface(), upgrades[ pick ], offset ) )DEBUG_LOG(("AI UPGRADE frame %d player %d queues '%s' at '%s' for %d, improves %.0f of what it owns, %.1f times the price where %.1f will do, %d in the bank, bank target %d, %d enemy kinds known\n",@@ -19038,7 +19084,7 @@ void AIPlayer::personaChat( const char *trigger )static void findFinishedSuperweapon( Object *obj, void *userData ){- if( obj->isKindOf( KINDOF_FS_SUPERWEAPON ) && !obj->isEffectivelyDead() && !obj->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) )+ if( IsSuperweaponInMatch( obj->getTemplate() ) && !obj->isEffectivelyDead() && !obj->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) )*(Bool *)userData = TRUE;}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cppindex 25e197bef..71079a731 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp@@ -269,7 +269,8 @@ void AISkirmishPlayer::processBaseBuilding( void )// pass, and a tech building asked for at frame 1932 was still in that queue at 30000.// A power plant jumps it as well once the margin is thin: the plant doPower asked for ahead// of an outage waited 45 seconds in that queue and the base went dark before it was started.- const Bool rushThis = rushBigGuns && (curPlan->isKindOf(KINDOF_FS_SUPERWEAPON) || curPlan->isKindOf(KINDOF_FS_ADVANCED_TECH) ||+ // A silo whose missile is silenced is no superweapon and is not rushed.+ const Bool rushThis = rushBigGuns && (IsSuperweaponInMatch(curPlan) || curPlan->isKindOf(KINDOF_FS_ADVANCED_TECH) ||(powerThin && curPlan->isKindOf(KINDOF_FS_POWER) && !curPlan->isKindOf(KINDOF_CASH_GENERATOR)));const AIPurchaseKind planKind = purchaseKindOf(curPlan);const Int planScore = byScore ? aiPurchaseScore(planKind, earlyGame) +diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cppindex 9e39d91b3..948a59810 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp@@ -161,6 +161,12 @@ SpecialPowerModule::SpecialPowerModule( Thing *thing, const ModuleData *moduleDa} // end SpecialPowerModule+//-------------------------------------------------------------------------------------------------+SpecialPowerModuleInterface* SpecialPowerModule::getSpecialPower()+{+ return SuperweaponMissileSilencedInMatch( getSpecialPowerTemplate()->getSpecialPowerType() ) ? NULL : this;+}+//-------------------------------------------------------------------------------------------------const AudioEventRTS& SpecialPowerModule::getInitiateSound() const{diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cppindex 38fea89b0..b7853509e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/MissileLauncherBuildingUpdate.cpp@@ -242,14 +242,17 @@ UpdateSleepTime MissileLauncherBuildingUpdate::update( void )if( getObject()->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION) )return UPDATE_SLEEP_NONE;+ // a silenced missile is no special power at all: the doors stay shut for the whole match+ if (SuperweaponMissileSilencedInMatch(d->m_specialPowerTemplate->getSpecialPowerType()))+ return UPDATE_SLEEP_FOREVER;+if (!m_specialPowerModule){m_specialPowerModule = getObject()->getSpecialPowerModule(d->m_specialPowerTemplate);DEBUG_ASSERTCRASH(m_specialPowerModule, ("Missing special power"));}-- // a missile that can never fire is never shown ready: the doors stay shut- if (m_specialPowerModule && !SuperweaponMissileSilencedInMatch(m_specialPowerModule->getSpecialPowerTemplate()->getSpecialPowerType()))++ if (m_specialPowerModule){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.cppindex 5694cf63a..3374ec0c0 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -21558,16 +21558,53 @@ TEST(the_superweapon_rule_is_a_mode_with_one_exception)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 );- // a human's, that is: a computer player builds no silo under No, whoever its general, since- // it put one up as its superweapon, and Limit and Allow leave it the same silo as anybody- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, AsciiString( "FactionChina" ), AsciiString( "ChinaNuclearMissileLauncher" ), TRUE ), (Int)SUPERWEAPON_CAP_BANNED );- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, AsciiString( "FactionChinaNukeGeneral" ), AsciiString( "Nuke_ChinaNuclearMissileLauncher" ), TRUE ), (Int)SUPERWEAPON_CAP_BANNED );- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, superweaponGeneral, AsciiString( "SupW_AmericaNuclearMissileLauncher" ), TRUE ), (Int)SUPERWEAPON_CAP_BANNED );- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, AsciiString( "FactionChina" ), AsciiString( "ChinaNuclearMissileLauncher" ), FALSE ), 1 );- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_LIMIT, AsciiString( "FactionChina" ), AsciiString( "ChinaNuclearMissileLauncher" ), TRUE ), 1 );- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_ALLOW, AsciiString( "FactionChina" ), AsciiString( "ChinaNuclearMissileLauncher" ), TRUE ), (Int)SUPERWEAPON_CAP_UNLIMITED );- // and the Superweapon General's own exception under No is unchanged for a computer- CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, superweaponGeneral, AsciiString( "SupW_AmericaParticleCannonUplink" ), TRUE ), 1 );+ // the same one silo for every China general, a computer as much as a human: the cap has no say+ // in who plays the seat+ const char *const chinaGenerals[][ 2 ] =+ {+ { "FactionChina", "ChinaNuclearMissileLauncher" },+ { "FactionChinaNukeGeneral", "Nuke_ChinaNuclearMissileLauncher" },+ { "FactionChinaTankGeneral", "Tank_ChinaNuclearMissileLauncher" },+ { "FactionChinaInfantryGeneral", "Infa_ChinaNuclearMissileLauncher" }+ };+ for ( Int g = 0; g < ARRAY_SIZE( chinaGenerals ); ++g )+ {+ const AsciiString general( chinaGenerals[ g ][ 0 ] ), silo( chinaGenerals[ g ][ 1 ] );+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, general, silo ), 1 );+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_LIMIT, general, silo ), 1 );+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_ALLOW, general, silo ), (Int)SUPERWEAPON_CAP_UNLIMITED );+ // and under No, or Pro Rules, it is an upgrade building and no superweapon of anybody's+ CHECK( SuperweaponSiloIsUpgradeBuilding( silo, FALSE, SUPERWEAPONS_NONE ) );+ CHECK( SuperweaponSiloIsUpgradeBuilding( silo, TRUE, SUPERWEAPONS_ALLOW ) );+ CHECK( !SuperweaponSiloIsUpgradeBuilding( silo, FALSE, SUPERWEAPONS_LIMIT ) );+ CHECK( !SuperweaponSiloIsUpgradeBuilding( silo, FALSE, SUPERWEAPONS_ALLOW ) );+ }++ // Under No the whole matrix: every other superweapon of every side and general is barred, the+ // Superweapon General's one cannon aside. The cap counts every superweapon a player has together+ // (the Superweapon link key), so 1 is one superweapon in all, not one of each.+ struct NoRow { const char *general; const char *superweapon; Int cap; };+ const NoRow noRows[] =+ {+ { "FactionAmerica", "AmericaParticleCannonUplink", SUPERWEAPON_CAP_BANNED },+ { "FactionAmericaLaserGeneral", "Lazr_AmericaParticleCannonUplink", SUPERWEAPON_CAP_BANNED },+ { "FactionAmericaAirForceGeneral", "AirF_AmericaParticleCannonUplink", SUPERWEAPON_CAP_BANNED },+ { "FactionAmericaSuperWeaponGeneral", "SupW_AmericaParticleCannonUplink", 1 },+ { "FactionGLA", "GLAScudStorm", SUPERWEAPON_CAP_BANNED },+ { "FactionGLAToxinGeneral", "Chem_GLAScudStorm", SUPERWEAPON_CAP_BANNED },+ { "FactionGLADemolitionGeneral", "Demo_GLAScudStorm", SUPERWEAPON_CAP_BANNED },+ { "FactionGLAStealthGeneral", "Slth_GLAScudStorm", SUPERWEAPON_CAP_BANNED },+ { "FactionTurkiye", "TurkiyeKarguBase", SUPERWEAPON_CAP_BANNED }+ };+ for ( Int r = 0; r < ARRAY_SIZE( noRows ); ++r )+ {+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, AsciiString( noRows[ r ].general ), AsciiString( noRows[ r ].superweapon ) ), noRows[ r ].cap );+ CHECK( !SuperweaponSiloIsUpgradeBuilding( AsciiString( noRows[ r ].superweapon ), FALSE, SUPERWEAPONS_NONE ) );+ }+ // the exception is the general, not the building: another general's cannon under his name is+ // still his one, and his cannon under anybody else's is barred+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, gla, AsciiString( "SupW_AmericaParticleCannonUplink" ) ), (Int)SUPERWEAPON_CAP_BANNED );+ CHECK_EQ( SuperweaponBuildCap( SUPERWEAPONS_NONE, superweaponGeneral, AsciiString( "GLAScudStorm" ) ), 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 );