From 5c467bc2b3cd7200683dc640f27b86d481eff2f8 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Mon, 30 Jun 2025 14:59:50 +0200 Subject: [PATCH 1/6] Added missing parentheses. --- .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 2 +- .../GameEngine/Source/Common/System/BuildAssistant.cpp | 2 +- .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp | 8 ++++---- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 8 ++++---- .../GameLogic/Object/Behavior/FlightDeckBehavior.cpp | 4 ++-- .../GameEngine/Source/GameNetwork/ConnectionManager.cpp | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index 117454fd75..d8ef06d48b 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -171,7 +171,7 @@ static Int getNextSelectablePlayer(Int start) static Int getFirstSelectablePlayer(const GameInfo *game) { const GameSlot *slot = game->getConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; itestStatus( OBJECT_STATUS_IS_USING_ABILITY ) || them->getAI() && them->getAI()->isBusy() ) + if( them->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || (them->getAI() && them->getAI()->isBusy()) ) { return LBC_OBJECTS_IN_THE_WAY; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index c99333ef94..31b1d978f2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -178,7 +178,7 @@ static Int getNextSelectablePlayer(Int start) static Int getFirstSelectablePlayer(const GameInfo *game) { const GameSlot *slot = game->getConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; igetConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) + if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) return game->getLocalSlotNum(); for (Int i=0; igetText())) + if (forceRecalc || (!m_isTooltipEmpty && tooltip.compare(m_tooltipDisplayString->getText()))) { m_tooltipDisplayString->setText(tooltip); //DEBUG_LOG(("Tooltip: %ls\n", tooltip.str())); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 5013e2e6eb..c73b944bea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -1435,8 +1435,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //Added: shrubberies are the exception for interactions... //Removed: GS Took out ObjectStatusUnselectable, since that status only prevents selection, not everything if( obj == NULL || - obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && - !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) + (obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && + !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE)) ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. @@ -3049,7 +3049,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame()) { Player *localPlayer = ThePlayerList->getLocalPlayer(); - if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers) + if ((localPlayer && localPlayer->isPlayerActive()) || !TheGlobalData->m_netMinPlayers) { ToggleInGameChat(); SetInGameChatType( INGAME_CHAT_ALLIES ); @@ -3063,7 +3063,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame()) { Player *localPlayer = ThePlayerList->getLocalPlayer(); - if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers) + if ((localPlayer && localPlayer->isPlayerActive()) || !TheGlobalData->m_netMinPlayers) { ToggleInGameChat(); SetInGameChatType( INGAME_CHAT_EVERYONE ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index d95b721634..9e16ece5a4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -667,11 +667,11 @@ Bool FlightDeckBehavior::reserveRunway(ObjectID id, Bool forLanding) } RunwayInfo& info = m_runways[runway]; - if( info.m_inUseByForTakeoff == id && !forLanding || info.m_inUseByForLanding == id && forLanding ) + if( (info.m_inUseByForTakeoff == id && !forLanding) || (info.m_inUseByForLanding == id && forLanding) ) { return true; } - else if( info.m_inUseByForTakeoff == INVALID_ID && !forLanding || info.m_inUseByForLanding == INVALID_ID && forLanding ) + else if( (info.m_inUseByForTakeoff == INVALID_ID && !forLanding) || (info.m_inUseByForLanding == INVALID_ID && forLanding) ) { if( forLanding ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 9900f2e2c5..f7cebe42c1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -666,7 +666,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg) Bool fromObserver = !player->isPlayerActive(); Bool amIObserver = !ThePlayerList->getLocalPlayer()->isPlayerActive(); - Bool canSeeChat = amIObserver || !fromObserver && !TheGameInfo->getConstSlot(playerID)->isMuted(); + Bool canSeeChat = amIObserver || (!fromObserver && !TheGameInfo->getConstSlot(playerID)->isMuted()); if ( ((1<getPlayerMask() ) && canSeeChat ) { From a38f221b17819dbc4b7f9bdbf1b4fc2a57298bb9 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Thu, 10 Jul 2025 16:23:22 +0200 Subject: [PATCH 2/6] Added assertion for ThingTemplate to ctor of PartitionFilterThing. --- Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h | 4 +++- .../Code/GameEngine/Include/GameLogic/PartitionManager.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h index 091b139935..aa8f6044b6 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1090,7 +1090,9 @@ class PartitionFilterThing : public PartitionFilter Bool m_match; public: - PartitionFilterThing(const ThingTemplate *thing, Bool match) : m_tThing(thing), m_match(match) {} + PartitionFilterThing(const ThingTemplate *thing, Bool match) : m_tThing(thing), m_match(match) { + DEBUG_ASSERTCRASH(m_tThing != NULL, ("ThingTemplate for PartitionFilterThing is NULL")); + } protected: virtual Bool allow( Object *other ); #if defined(RTS_DEBUG) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h index aae710f2b5..7caf5dac68 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/PartitionManager.h @@ -1127,7 +1127,9 @@ class PartitionFilterThing : public PartitionFilter Bool m_match; public: - PartitionFilterThing(const ThingTemplate *thing, Bool match) : m_tThing(thing), m_match(match) {} + PartitionFilterThing(const ThingTemplate *thing, Bool match) : m_tThing(thing), m_match(match) { + DEBUG_ASSERTCRASH(m_tThing != NULL, ("ThingTemplate for PartitionFilterThing is NULL")); + } protected: virtual Bool allow( Object *other ); #if defined(RTS_DEBUG) From b114b3a62bee3ebd43777ebf2f232f7009b170c1 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Thu, 10 Jul 2025 16:40:27 +0200 Subject: [PATCH 3/6] Change order of NULL checks. --- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- .../Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index a90c6141d1..c8ff78568a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -232,7 +232,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) } } } - if (powerPlan && powerInfo && !powerPlan->isEquivalentTo(bldgPlan)) { + if (powerInfo && powerPlan && !powerPlan->isEquivalentTo(bldgPlan)) { if (!powerUnderConstruction) { bldgPlan = powerPlan; bldgInfo = powerInfo; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 9eccc23c26..20453afdef 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -239,7 +239,7 @@ void AISkirmishPlayer::processBaseBuilding( void ) } } } - if (powerPlan && powerInfo && !powerPlan->isEquivalentTo(bldgPlan)) { + if (powerInfo && powerPlan && !powerPlan->isEquivalentTo(bldgPlan)) { if (!powerUnderConstruction) { bldgPlan = powerPlan; bldgInfo = powerInfo; From 9ee76ae7256ed70e679b583914323b3e3e737289 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Thu, 10 Jul 2025 16:44:49 +0200 Subject: [PATCH 4/6] Shared Gen/ZH changes. --- Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp | 2 +- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 5 ++--- .../Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp | 2 +- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 5 ++--- .../Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp | 2 +- .../GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp | 2 +- 8 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp index 27c6824482..c6fc5d1d06 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp @@ -174,7 +174,7 @@ Int ScoreKeeper::getTotalObjectsBuilt( const ThingTemplate *pTemplate ) for (ObjectCountMapIt it = m_objectsBuilt.begin(); it != m_objectsBuilt.end(); ++it) { const ThingTemplate *theTemplate = it->first; - if (theTemplate->isEquivalentTo(pTemplate)) + if (theTemplate && theTemplate->isEquivalentTo(pTemplate)) ++count; } return count; diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index a833bce0ed..afaa2d3425 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -1218,9 +1218,8 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate // get this button commandButton = commandSet->getCommandButton(i); if( commandButton && - (commandButton->getCommandType() == GUI_COMMAND_UNIT_BUILD || - commandButton->getCommandType() == GUI_COMMAND_DOZER_CONSTRUCT) && - commandButton->getThingTemplate()->isEquivalentTo(whatToBuild) ) + (commandButton->getCommandType() == GUI_COMMAND_UNIT_BUILD || commandButton->getCommandType() == GUI_COMMAND_DOZER_CONSTRUCT) && + commandButton->getThingTemplate() && commandButton->getThingTemplate()->isEquivalentTo(whatToBuild) ) foundCommand = commandButton; } // end for i diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index bfa6a90533..bfa52f547e 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -1319,7 +1319,7 @@ const AudioEventRTS *ThingTemplate::getPerUnitSound(const AsciiString& soundName Bool ThingTemplate::isEquivalentTo(const ThingTemplate* tt) const { // sanity - if (!(this && tt)) + if (!tt) return false; // sanity diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 8b6c56b855..32fca872c1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1738,7 +1738,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if (beacon) { const ThingTemplate *thing = TheThingFactory->findTemplate( beacon->getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate() ); - if (thing->isEquivalentTo(beacon->getTemplate())) + if (thing && thing->isEquivalentTo(beacon->getTemplate())) { if (beacon->getControllingPlayer() == thisPlayer) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp index 7fcb1079f8..64eed70f7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp @@ -174,7 +174,7 @@ Int ScoreKeeper::getTotalObjectsBuilt( const ThingTemplate *pTemplate ) for (ObjectCountMapIt it = m_objectsBuilt.begin(); it != m_objectsBuilt.end(); ++it) { const ThingTemplate *theTemplate = it->first; - if (theTemplate->isEquivalentTo(pTemplate)) + if (theTemplate && theTemplate->isEquivalentTo(pTemplate)) ++count; } return count; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 344c12ed0f..b4ae257d95 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -1271,9 +1271,8 @@ Bool BuildAssistant::isPossibleToMakeUnit( Object *builder, const ThingTemplate // get this button commandButton = commandSet->getCommandButton(i); if( commandButton && - (commandButton->getCommandType() == GUI_COMMAND_UNIT_BUILD || - commandButton->getCommandType() == GUI_COMMAND_DOZER_CONSTRUCT) && - commandButton->getThingTemplate()->isEquivalentTo(whatToBuild) ) + (commandButton->getCommandType() == GUI_COMMAND_UNIT_BUILD || commandButton->getCommandType() == GUI_COMMAND_DOZER_CONSTRUCT) && + commandButton->getThingTemplate() && commandButton->getThingTemplate()->isEquivalentTo(whatToBuild) ) foundCommand = commandButton; } // end for i diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index fbf5f99fb8..4c4621b8f8 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -1474,7 +1474,7 @@ UnsignedInt ThingTemplate::getMaxSimultaneousOfType() const Bool ThingTemplate::isEquivalentTo(const ThingTemplate* tt) const { // sanity - if (!(this && tt)) + if (!tt) return false; // sanity diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 7c51aba5b2..9f9771faa8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -1766,7 +1766,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) if (beacon) { const ThingTemplate *thing = TheThingFactory->findTemplate( beacon->getControllingPlayer()->getPlayerTemplate()->getBeaconTemplate() ); - if (thing->isEquivalentTo(beacon->getTemplate())) + if (thing && thing->isEquivalentTo(beacon->getTemplate())) { if (beacon->getControllingPlayer() == thisPlayer) { From 5c33dbbe48780f66a8279f940b7306c7d0d3fb12 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Thu, 10 Jul 2025 16:45:33 +0200 Subject: [PATCH 5/6] ZH only changes. --- GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp | 8 ++++---- .../GameLogic/Object/Contain/RiderChangeContain.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index 34ab9806b1..87854745c3 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -1377,7 +1377,7 @@ static void doFindMostReadyWeaponForThing( Object *obj, void *userData ) return; } - if( info->thing->isEquivalentTo( obj->getTemplate() ) ) + if( info->thing && info->thing->isEquivalentTo( obj->getTemplate() ) ) { if( !obj->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) && !obj->testStatus( OBJECT_STATUS_SOLD ) @@ -1409,7 +1409,7 @@ static void doFindMostReadySpecialPowerForThing( Object *obj, void *userData ) return; } - if( info->thing->isEquivalentTo( obj->getTemplate() ) ) + if( info->thing && info->thing->isEquivalentTo( obj->getTemplate() ) ) { if( !obj->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) && !obj->testStatus( OBJECT_STATUS_SOLD ) @@ -1445,7 +1445,7 @@ static void doFindExistingObjectWithThingTemplate( Object *obj, void *userData ) return; } - if( info->thing->isEquivalentTo( obj->getTemplate() ) ) + if( info->thing && info->thing->isEquivalentTo( obj->getTemplate() ) ) { if( !obj->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) && !obj->testStatus( OBJECT_STATUS_SOLD ) @@ -2863,7 +2863,7 @@ static void countExisting( Object *obj, void *userData ) TypeCountData *typeCountData = (TypeCountData *)userData; // Compare templates - if ( typeCountData->type->isEquivalentTo( obj->getTemplate() ) || + if ( ( typeCountData->type && typeCountData->type->isEquivalentTo( obj->getTemplate() ) ) || ( typeCountData->linkKey != NAMEKEY_INVALID && obj->getTemplate() != NULL && typeCountData->linkKey == obj->getTemplate()->getMaxSimultaneousLinkKey() ) ) { typeCountData->count++; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp index 96aa3edcec..032dda3f96 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/RiderChangeContain.cpp @@ -170,7 +170,7 @@ Bool RiderChangeContain::isValidContainerFor(const Object* rider, Bool checkCapa for( int i = 0; i < MAX_RIDERS; i++ ) { const ThingTemplate *thing = TheThingFactory->findTemplate( data->m_riders[ i ].m_templateName ); - if( thing->isEquivalentTo( rider->getTemplate() ) ) + if( thing && thing->isEquivalentTo( rider->getTemplate() ) ) { //We found a valid rider, so return success. return TRUE; @@ -211,7 +211,7 @@ void RiderChangeContain::onContaining( Object *rider, Bool wasSelected ) for( int i = 0; i < MAX_RIDERS; i++ ) { const ThingTemplate *thing = TheThingFactory->findTemplate( data->m_riders[ i ].m_templateName ); - if( thing->isEquivalentTo( rider->getTemplate() ) ) + if( thing && thing->isEquivalentTo( rider->getTemplate() ) ) { //This is our rider, so set the correct model condition. @@ -282,7 +282,7 @@ void RiderChangeContain::onRemoving( Object *rider ) for( int i = 0; i < MAX_RIDERS; i++ ) { const ThingTemplate *thing = TheThingFactory->findTemplate( data->m_riders[ i ].m_templateName ); - if( thing->isEquivalentTo( rider->getTemplate() ) ) + if( thing && thing->isEquivalentTo( rider->getTemplate() ) ) { //This is our rider, so clear the current model condition. bike->clearModelConditionFlags( MAKE_MODELCONDITION_MASK2( data->m_riders[ i ].m_modelConditionFlagType, MODELCONDITION_DOOR_1_CLOSING ) ); From e5509c6a3744a9c8d35e71e9740c7a82604a9a22 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Thu, 10 Jul 2025 16:54:24 +0200 Subject: [PATCH 6/6] Revert "Added missing parentheses." This reverts commit 5c467bc2b3cd7200683dc640f27b86d481eff2f8. --- .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 2 +- .../GameEngine/Source/Common/System/BuildAssistant.cpp | 2 +- .../GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp | 2 +- .../GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp | 8 ++++---- .../Code/GameEngine/Source/GameClient/Input/Mouse.cpp | 2 +- .../Source/GameClient/MessageStream/CommandXlat.cpp | 8 ++++---- .../GameLogic/Object/Behavior/FlightDeckBehavior.cpp | 4 ++-- .../GameEngine/Source/GameNetwork/ConnectionManager.cpp | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index b55da2ffcf..450240907d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -166,7 +166,7 @@ static Int getNextSelectablePlayer(Int start) static Int getFirstSelectablePlayer(const GameInfo *game) { const GameSlot *slot = game->getConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) + if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) return game->getLocalSlotNum(); for (Int i=0; itestStatus( OBJECT_STATUS_IS_USING_ABILITY ) || (them->getAI() && them->getAI()->isBusy()) ) + if( them->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || them->getAI() && them->getAI()->isBusy() ) { return LBC_OBJECTS_IN_THE_WAY; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index e34104d484..361767ca89 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -173,7 +173,7 @@ static Int getNextSelectablePlayer(Int start) static Int getFirstSelectablePlayer(const GameInfo *game) { const GameSlot *slot = game->getConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) + if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) return game->getLocalSlotNum(); for (Int i=0; igetConstSlot(game->getLocalSlotNum()); - if (!game->amIHost() || (slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER)) + if (!game->amIHost() || slot && slot->getPlayerTemplate() != PLAYERTEMPLATE_OBSERVER) return game->getLocalSlotNum(); for (Int i=0; igetText()))) + if (forceRecalc || !m_isTooltipEmpty && tooltip.compare(m_tooltipDisplayString->getText())) { m_tooltipDisplayString->setText(tooltip); //DEBUG_LOG(("Tooltip: %ls\n", tooltip.str())); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 08d470917d..057d9387ac 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -1430,8 +1430,8 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, //Added: shrubberies are the exception for interactions... //Removed: GS Took out ObjectStatusUnselectable, since that status only prevents selection, not everything if( obj == NULL || - (obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && - !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE)) ) + obj->getStatusBits().test( OBJECT_STATUS_MASKED ) && + !obj->isKindOf(KINDOF_SHRUBBERY) && !obj->isKindOf(KINDOF_FORCEATTACKABLE) ) { //Nulling out the draw and obj pointer will force the remainder of this code to evaluate //a position interaction. @@ -3050,7 +3050,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame()) { Player *localPlayer = ThePlayerList->getLocalPlayer(); - if ((localPlayer && localPlayer->isPlayerActive()) || !TheGlobalData->m_netMinPlayers) + if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers) { ToggleInGameChat(); SetInGameChatType( INGAME_CHAT_ALLIES ); @@ -3064,7 +3064,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage if (TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInReplayGame()) { Player *localPlayer = ThePlayerList->getLocalPlayer(); - if ((localPlayer && localPlayer->isPlayerActive()) || !TheGlobalData->m_netMinPlayers) + if (localPlayer && localPlayer->isPlayerActive() || !TheGlobalData->m_netMinPlayers) { ToggleInGameChat(); SetInGameChatType( INGAME_CHAT_EVERYONE ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp index f1fef185d3..cb24d4afee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/FlightDeckBehavior.cpp @@ -662,11 +662,11 @@ Bool FlightDeckBehavior::reserveRunway(ObjectID id, Bool forLanding) } RunwayInfo& info = m_runways[runway]; - if( (info.m_inUseByForTakeoff == id && !forLanding) || (info.m_inUseByForLanding == id && forLanding) ) + if( info.m_inUseByForTakeoff == id && !forLanding || info.m_inUseByForLanding == id && forLanding ) { return true; } - else if( (info.m_inUseByForTakeoff == INVALID_ID && !forLanding) || (info.m_inUseByForLanding == INVALID_ID && forLanding) ) + else if( info.m_inUseByForTakeoff == INVALID_ID && !forLanding || info.m_inUseByForLanding == INVALID_ID && forLanding ) { if( forLanding ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp index 87f066918b..a6a2282daa 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp @@ -661,7 +661,7 @@ void ConnectionManager::processChat(NetChatCommandMsg *msg) Bool fromObserver = !player->isPlayerActive(); Bool amIObserver = !ThePlayerList->getLocalPlayer()->isPlayerActive(); - Bool canSeeChat = amIObserver || (!fromObserver && !TheGameInfo->getConstSlot(playerID)->isMuted()); + Bool canSeeChat = amIObserver || !fromObserver && !TheGameInfo->getConstSlot(playerID)->isMuted(); if ( ((1<getPlayerMask() ) && canSeeChat ) {